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

using namespace std;

#define FOR(v,p,k) for(int v=p;v<=k;++v)
#define FORD(v,p,k) for(int v=p;v>=k;--v)
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(x) memset(x,0,sizeof(x))

typedef long long LL;
typedef unsigned long long ULL;

const int INF = 1000000000;

const int MAX = 44;
int F[MAX];

int main(int argc, char **args)
{
	F[0] = 1;
	F[1] = 1;

	FOR(i, 2, MAX - 1)
		F[i] = F[i - 1] + F[i - 2];

	int t, n;

	scanf("%d", &t);

	REP(i, t)
	{
		scanf("%d", &n);

		if (n == 0)
		{
			printf("TAK\n");
			continue;
		}

		bool found = false;

		REP(j, MAX)
		{
			if (n % F[j] == 0)
			{
				int x = n / F[j];

				REP(k, MAX)
				{
					if (F[k] == x)
					{
						found = true;
						break;
					}
				}
			}

			if (found)
				break;
		}

		if (found)
			printf("TAK\n");
		else
			printf("NIE\n");
	}

	return 0;
}