1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <cstdio>
#include <set>

using namespace std;

int main() {
	set<int> ok;
	int fibb[45];
	fibb[0] = 0;
	fibb[1] = 1;
	for( int i = 2; i < 45; i++ )
		fibb[i] = fibb[i-1] + fibb[i-2];
	for( int i = 0; i < 45; i++ )
		for( int j = i; j < 45; j++ ) {
			auto m = 1LL * fibb[i] * fibb[j];
			if( m <= 1000000000 )
				ok.insert(m);
		}
	
	int T;
	scanf("%d", &T);
	while( T --> 0 ) {
		int n;
		scanf("%d", &n);
		puts( ok.count(n) == 1 ? "TAK" : "NIE" );
	}
	return 0;
}