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

using namespace std;

const int BOUND = 1000*1000*1000;
vector<long long> fib;

void test() {
	long long d;
	scanf("%lld", &d);

	for(auto &x : fib) {
		for(auto &y : fib) {
			if(x*y==d) {
				printf("TAK\n");
				return;
			}
		}
	}
	printf("NIE\n");
}

void genfib() {
	long long a = 0;
	long long b = 1;
	fib.push_back(a);
	while(b <= BOUND) {
		fib.push_back(b);
		swap(a, b);
		b += a;
	}
}

int main() {
	int t;
	genfib();
	scanf("%d", &t);
	while(t--) test();
	return 0;
}