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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
long int fibs[50];
long int fibs2[50];
const int MAX_IT=45;
void res(long int *l)
{
        std::cout<<*l<<"-----"<<std::endl;
}

void fib(long int *l1, long int *l2)
{
	long int tmp = *l2;
	*l2 = *l2 + *l1;
	*l1 = tmp;
}
bool egz(long int *fib,long int *c,int max)
{
	if(*fib==0) return false;
	long int div = *c-*fib;
	long int rest = 0;
	long int count = 1;
	while(div >= 0)
	{
		div -= *fib;
		count++;
	}
	
	if(div!=0) return false;
	
	for(int i=0;i<MAX_IT;i++)
	{
		std::cout<<"c="<<*c<<" rest="<<rest<<" fib="<<*fib<<" fib["<<i<<"]="<<fib[i]<<" max="<<max<<std::endl;
		if(count==fib[i]) return true;
	}
	return false;
}
void check(long int *l)
{
	for(int i=1;i<MAX_IT;i++)
	{
		if(*l%fibs[i]==0)
		{
			long int num = *l/fibs[i];
			for(int j=1;j<MAX_IT;j++)
			{
				if(num==fibs[j]){
					std::cout<<"TAK"<<std::endl;
					return;
				}
			}
		}
	}
	std::cout<<"NIE"<<std::endl;
}
int main(int argc, char **argv)
{
        int ll = 0;
        int a = 0;
		fibs[0]=0;
		fibs[1]=1;

		for(int i=2;i<MAX_IT;i++)
        {
			fibs[i]=fibs[i-1]+fibs[i-2];
        }

        int f = scanf("%d", &a);
		long int l = 0;
        
        for(int i=0;i<a;i++)
		{
			f = scanf("%Ld", &l);
			check(&l);
		}
		
        return(0);
}