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
42
43
44
45
46
47
48
49
50
51
52
53
#include <cstdio>
#include <set>

using namespace std;
set<int> fib;

void gen()
{
	fib.insert(1);
	fib.insert(2);
	int pp=1,p=2;
	int last = pp + p;
	fib.insert(last);
	while(last <1000000001)
	{ 
		pp = p; p = last;
		last = pp + p;
		fib.insert(last);
	}	
}

void check(int l)
{
	if (l==0) {
		printf("TAK\n");
		return;
	}

	for (set<int>::iterator it = fib.begin(); *it * *it <= l && it != fib.end(); ++it)

	{
		if (l%(*it)==0 && fib.find(l/(*it))!=fib.end())
		{
			printf("TAK\n");
			return;
		}
	}
	printf("NIE\n", l);
}
	
int main()
{
	int z;
	gen();
	scanf("%d", &z);
	for (int i = 0; i < z; i++)
	{
		int l;
		scanf("%d", &l);
		check(l);
	}
	return 0;
}