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
#include <iostream>
#include <vector>
#include <set>

using namespace std;

int a, b, t;
vector<long long> v;
set<long long> r;

int main() {
	a = 0, b = 1;
	v.push_back(0);
	while (a <= 1000000000) {
		a = a + b;
		v.push_back(a);
		swap(a, b);
	}
	for (int i=0; i<v.size(); i++) {
		for (int j=0; j<v.size(); j++) {
			r.insert(v[i] * v[j]);
		}
	}
	cin >> t;
	while (t--) {
		cin >> a;
		cout << ((r.find(a) != r.end()) ? "TAK\n" : "NIE\n");
	}
	return 0;
}