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
#include <iostream>
#include <algorithm>
using namespace std;
int n,m,i,j, k = 1, N = 1000000000,t;
long long F[45]={0,1};
long long IL[946];


int main(int argc, char** argv) {

	for(i = 2; F[i-1] <= N; i++) F[i] = F[i-2] + F[i-1];
	//cout << i; 
	//for(i = 0; i < 45; ++i) cout << F[i] <<" "; cout << endl;
	for(i = 2; i < 45; ++i)
		for(j = 2; j < 45 ; ++j )
			if(F[i]*F[j] <= N) IL[k++] = F[i]*F[j];
	sort(IL, IL + k);
	//cout << k << endl;
	//for(i = 0; i < k+10; ++i) cout << IL[i] <<" ";
	cin >> t;
	while(t--)
	{
		cin >> n;
		for(i = 0; i < k; ++i) if(IL[i] == n) break;
		if (i == k) cout << "NIE" << endl;
		else cout <<" TAK" << endl;
	}
	return 0;
}