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
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

typedef long long i64;

int main(){
	vector<i64> fibs;
	fibs.push_back(0);fibs.push_back(1);
	while(true){
		i64 x = fibs[fibs.size()-1]+fibs[fibs.size()-2];
		if(x>1000000000)
			break;
		fibs.push_back(x);
	}

	int z;
	scanf("%d",&z);
	while(z--){
		i64 y;
		scanf("%lld",&y);
		
		bool ok = false;
		for(int i=1;i<fibs.size();i++)
			if(y%fibs[i] == 0){
				auto res = std::find(fibs.begin(), fibs.end(), y/fibs[i]);
				if(res != fibs.end()){
					ok = true;
					break;
				}
			}
		printf("%s\n",ok?"TAK":"NIE");
	}
	return 0;
}