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

int Fibo[45];

inline void fillFibo() {
	Fibo[0] = 0;
	Fibo[1] = 1;
	
	for (int i = 2; i < 45; ++i) Fibo[i] = Fibo[i - 1] + Fibo[i - 2];
}


bool isProductFibonacci(int value) {
	long long int tmp;
	
	for (int i = 0; i < 45; ++i) {
		for (int j = 0; j < 45; j++) {
			tmp = Fibo[i] * Fibo[j];
			if (tmp == value) return true;
		}
	}
	return false;
}


int main() {
	
	fillFibo();
	int t;
	int value;
	cin >> t;
	for (int i = 0; i < t; ++i) {
		cin >> value;
		if (isProductFibonacci(value)) cout << "TAK" << endl;
		else cout << "NIE" << endl;
	}

	//system("Pause");
	return 0;
}