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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include<cstdio>


void ciagFibonacciego(unsigned int tab[]){
	tab[0] = 0;
	tab[1] = 1;
	
		int i = 1;
		while(i < 46){//tworzenie ciagu Fibonacciego
			tab[i+1] = tab[i] + tab[i - 1];
			i++;
		}
	
}

int main(){
	int n;
	scanf("%d", &n);//ilosc testow
	int k;
	unsigned int ciag[47];
	ciagFibonacciego(ciag);
	
	while(n > 0){
		n--;
		scanf("%d", &k);//szukana
		
		if(k == 0 || k == 1)
			printf("%s\n", "TAK");
			
		else{
			int i = 3;
			int tmp = 0;
			bool flaga = false;
			
			while(k > ciag[i] && flaga == false){
				
				if(k % ciag[i] == 0){//podzielna
					tmp = k / ciag[i];
					int j = i;
					
					while(tmp >= ciag[j] && flaga == false){//szukanie drugiej liczby
						
						if(ciag[j] == tmp){
							flaga = true;
						}
						j++;
					}
				}
				i++;
			}
			if(flaga == false && ciag[i] != k)
				printf("%s\n", "NIE");
			else
				printf("%s\n", "TAK");
		}
	}
	
	return 0;
	
}