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

typedef long long int lli;

const lli LIMIT = 1000000000;

int main(){
	
	vector<lli> numbers;
	set<lli> multiplies;
	lli a = 0; lli b = 1;
	while (a <= LIMIT){
		numbers.push_back(a);
		multiplies.insert(a);
		b = b + a; a = b - a;
	}

	int N = numbers.size();
	lli ij;
	for (int i = 3; i < N; i++){
		for (int j = i; j < N; j++){
			ij = numbers[i] * numbers[j];
			if (ij <= LIMIT){
				multiplies.insert(ij);
			}
			else {
				break;
			}
		}
	}

	int t;
	lli n;

	cin >> t;
	for (int i = 0; i < t; i++){
		cin >> n;
		if (multiplies.end() != multiplies.find(n)){
			cout << "TAK" << endl;
		} else {
			cout << "NIE" << endl;
		}
	}

	return 0;
}