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 <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
	const int N = 1000000000;

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

	int next;
	while ( (next = v[v.size() - 2] + v[v.size() - 1]) <= N )
		v.push_back( next );

	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;

		bool found = false;
		for (unsigned int a = 0; a < v.size(); a++)
		{
			for (unsigned int b = 0; b < v.size(); b++)
			{
				if ((long long int)v[a] * (long long int)v[b] == x)
				{
					found = true;
					break;
				}
			}
			if (found)
				break;
		}

		cout << (found ? "TAK\n" : "NIE\n");
	}

	return 0;
}