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
#include <set>
#include <cstdio>
#define MILIARD 1 ## 000 ## 000 ## 000

int main()
{
	std::set<int> ciag;
	int a = 1, b = 2, fib = a+b;
	int testow, n;
	bool daSie;

	ciag.insert(1);
	ciag.insert(2);

	while (fib<=MILIARD)
	{
		ciag.insert(fib);
		a = b;
		b = fib;
		fib += a;
	}

	scanf("%d", &testow);

	while(testow--)
	{
		daSie = false;
		scanf("%d", &n);

		if (n==0)
			daSie = true;

		for (std::set<int>::iterator it=ciag.begin();it!=ciag.end();it++)
		{
			fib = *it;
			if (fib * fib > n)
				break;
			else if (n%fib == 0 && ciag.find(n/fib)!=ciag.end())
			{
				daSie = true;
				break;
			}
		}

		puts(daSie? "TAK": "NIE");
	}

	return 0;
}