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
#include <cstdio>
#include <vector>

using namespace std;

vector<int> val;

bool testFib(int x) {
	if (x == 0) return true;
	for (auto it = val.begin(); it != val.end(); ++it) {
		int a = *it;
		for (auto it2 = it; it2 != val.end(); ++it2) {
			int b = *it2;
			if (a * b == x) return true;
		}
	}
	return false;
}

int main() {
	int a = 1, b = 1, c;
	while (a <= 1000000000) {
		val.push_back(a);
		int c = a + b;
		a = b;
		b = c;
	}

	int t, n;
	scanf("%d", &t);
	for (int i = 0; i < t; i++) {
		scanf("%d", &n);
		printf("%s\n", testFib(n) ? "TAK" : "NIE");
	}

	return 0;
}