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

vector <int> FIB;

void pre () {
	FIB.push_back(0);
	FIB.push_back(1);
	FIB.push_back(2);
	int prev = 1;
	int cur = 2;
	while(true) {
		int c = prev;
		prev = cur;
		cur += c;
		if(cur <= 1000000000)
			FIB.push_back(cur);
		else
			break;
	}
}

bool isProduct(int x) {
	for(int i = 0; i < FIB.size(); i++)
		for(int j = 0; j < FIB.size(); j++)
			if((long long) FIB[i] * (long long) FIB[j] == x)
				return true;
	return false;
}

int main() {
	int t;
	cin >> t;
	pre();
	while(t--) {
		int n;
		scanf("%d", &n);
		printf(isProduct(n) ? "TAK\n" : "NIE\n");
	}
	return 0;
}