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
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<cstdio>
#include<algorithm>
using namespace std;


int main(){
	int Z;
	scanf("%d", &Z);
	while(Z--){
		int in;
		scanf("%d", &in);
		
		if(in == 0){
			printf("TAK\n");
			continue;
		}
		vector<int> gr8;
		int a = 1, b = 1;
		do{
			if(in%b == 0)
				gr8.push_back(in/b);
			b = a+b;
			a = b-a;
		}while(b*b <= in);
		a = b-a;
		b = b-a;
		sort(gr8.begin(), gr8.end());
		bool res = false;
		while(b <= in){
			if(binary_search(gr8.begin(), gr8.end(), b))
				res = true;
			b = a+b;
			a = b-a;
		}
		if(res)
			printf("TAK\n");
		else
			printf("NIE\n");
	}
	return 0;
}