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

int main()
{
	int a = 1;
	int b = 1;
	int c;

	vector <int> tab;
	tab.push_back(1);

	while(a <= 1000000)
	{
		c = a + b;
		b = a;
		a = c;
		tab.push_back(a);
	}

	vector <int> t;

	for(int i = 0; i < tab.size(); ++i) 
	{
		for(int j = i; j < tab.size(); ++j)
		{
			long long pom = (long long) tab[i] * tab[j];
			if(pom <= 1000000) t.push_back(pom);
		}
	}

	int prz;
	cin >> prz;
	for(int i = 0; i < prz; ++i)
	{
		int a;
		cin >> a;
		int w = 0;
		for(int j = 0; j < t.size(); ++j) if(a == t[j]) w = 1;
		if(w) cout << "TAK" << endl;
		else cout << "NIE" << endl;
	}

	return 0;
}