1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <set>
using namespace std;
int main()
{
	unsigned const max=1000000000;
	unsigned fibs[46];
	int T;
	unsigned a;
	fibs[0]=0; fibs[1]=1;
	for(int i=2; i<47; i++)
		fibs[i]=fibs[i-2]+fibs[i-1];
	set<unsigned> fibfac;
	for(int i=1; i<47; i++)
		for(int k=0; k<47; k++)
			if(fibs[k] <= max/fibs[i]) fibfac.insert(fibs[i]*fibs[k]);
	cin>>T;
	while(T-->0)
	{
		cin>>a;
		if(fibfac.find(a)!=fibfac.end()) cout << "TAK\n";
		else cout << "NIE\n";
	}
}