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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <vector>
#include<cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

long long getMaxValueFromList(vector<long long> lista)
{
	long long max = -1l;
	for (vector<long long>::iterator it = lista.begin(); it != lista.end(); it++)
	{
		if (*it>max)
		{
			max = *it;
		}
	}

	return max;
}

void InitData(long long max, vector<long long> &fib, vector<long long> &ilo) 
{
	fib.push_back(0l);
	fib.push_back(1l);

	int i = 2;
	long long currentFib = 1l;
	while(max>currentFib)
	{
		currentFib = fib[i-2]+fib[i-1];
		fib.push_back(currentFib);
		i++;
	}

	for(i = 2;i<fib.size();i++)
	{
		long long l = fib[i];
		for(int j = 0;j<fib.size();j++)
		{
			long long iloczyn = l * fib[j];
			if (iloczyn <=max)
			{
				ilo.push_back(iloczyn);
				
			}
		}
	}
	

}

int main() 
{
	    int N;
        long long max = -1l;
		vector<long long> liczby;
		vector<long long> fib;
		vector<long long> ilo;

		cin>>N;
		for(int i=0;i<N;i++)
		{
			long long l;
			cin>>l;
			liczby.push_back(l);
		}


        max = getMaxValueFromList(liczby);
        
        if (max != -1)
        {
			InitData(max, fib, ilo);

			for (vector<long long>::iterator liczba = liczby.begin(); liczba != liczby.end(); liczba++)
			{
				vector<long long>::iterator findIter = find(ilo.begin(), ilo.end(), *liczba);

				if ( ilo.end() != findIter )
				{
					cout<<"TAK"<<endl;
				}
				else
				{
					cout<<"NIE"<<endl;
				}

			}
		}
}