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
43
44
45
#include <cstdio>
#include <cmath>
using namespace std;

int fibo[100];
int nFibo;

void findFibo(){
	int fib1 = 1;
	int fib2 = 1;
	fibo[0] = 1;
	nFibo = 1;
	
	while(fib2 <= 1000000001){	
		int next = fib1 + fib2;
		fibo[nFibo++] = next;
		fib1 = fib2;
		fib2 = next;
	}
}

bool isDiv(int x){
	if(x < 7) return true;

	for(int i=0; i<nFibo; i++)
		for(int j=0; j<nFibo; j++)
			if(fibo[i] * fibo[j] == x)
				return true;
				
	return false;
}

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

	return 0;
}