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

int products[] = {0,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,
6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,
2178309,3524578,5702887,9227465,14930352,24157817,39088169,63245986,102334155,
165580141,267914296,433494437,701408733,4,6,10,16,26,42,68,110,178,288,466,754,
1220,1974,3194,5168,8362,13530,21892,35422,57314,92736,150050,242786,392836,
635622,1028458,1664080,2692538,4356618,7049156,11405774,18454930,29860704,
48315634,78176338,126491972,204668310,331160282,535828592,866988874,9,15,24,39,
63,102,165,267,432,699,1131,1830,2961,4791,7752,12543,20295,32838,53133,85971,
139104,225075,364179,589254,953433,1542687,2496120,4038807,6534927,10573734,
17108661,27682395,44791056,72473451,117264507,189737958,307002465,496740423,
803742888,25,40,65,105,170,275,445,720,1165,1885,3050,4935,7985,12920,20905,
33825,54730,88555,143285,231840,375125,606965,982090,1589055,2571145,4160200,
6731345,10891545,17622890,28514435,46137325,74651760,120789085,195440845,
316229930,511670775,827900705,64,104,168,272,440,712,1152,1864,3016,4880,7896,
12776,20672,33448,54120,87568,141688,229256,370944,600200,971144,1571344,
2542488,4113832,6656320,10770152,17426472,28196624,45623096,73819720,119442816,
193262536,312705352,505967888,818673240,169,273,442,715,1157,1872,3029,4901,
7930,12831,20761,33592,54353,87945,142298,230243,372541,602784,975325,1578109,
2553434,4131543,6684977,10816520,17501497,28318017,45819514,74137531,119957045,
194094576,314051621,508146197,822197818,441,714,1155,1869,3024,4893,7917,12810,
20727,33537,54264,87801,142065,229866,371931,601797,973728,1575525,2549253,
4124778,6674031,10798809,17472840,28271649,45744489,74016138,119760627,
193776765,313537392,507314157,820851549,1156,1870,3026,4896,7922,12818,20740,
33558,54298,87856,142154,230010,372164,602174,974338,1576512,2550850,4127362,
6678212,10805574,17483786,28289360,45773146,74062506,119835652,193898158,
313733810,507631968,821365778,3025,4895,7920,12815,20735,33550,54285,87835,
142120,229955,372075,602030,974105,1576135,2550240,4126375,6676615,10802990,
17479605,28282595,45762200,74044795,119806995,193851790,313658785,507510575,
821169360,7921,12816,20737,33553,54290,87843,142133,229976,372109,602085,
974194,1576279,2550473,4126752,6677225,10803977,17481202,28285179,45766381,
74051560,119817941,193869501,313687442,507556943,821244385,20736,33552,54288,
87840,142128,229968,372096,602064,974160,1576224,2550384,4126608,6676992,
10803600,17480592,28284192,45764784,74048976,119813760,193862736,313676496,
507539232,821215728,54289,87841,142130,229971,372101,602072,974173,1576245,
2550418,4126663,6677081,10803744,17480825,28284569,45765394,74049963,119815357,
193865320,313680677,507545997,821226674,142129,229970,372099,602069,974168,
1576237,2550405,4126642,6677047,10803689,17480736,28284425,45765161,74049586,
119814747,193864333,313679080,507543413,821222493,372100,602070,974170,1576240,
2550410,4126650,6677060,10803710,17480770,28284480,45765250,74049730,119814980,
193864710,313679690,507544400,821224090,974169,1576239,2550408,4126647,6677055,
10803702,17480757,28284459,45765216,74049675,119814891,193864566,313679457,
507544023,821223480,2550409,4126648,6677057,10803705,17480762,28284467,
45765229,74049696,119814925,193864621,313679546,507544167,821223713,6677056,
10803704,17480760,28284464,45765224,74049688,119814912,193864600,313679512,
507544112,821223624,17480761,28284465,45765226,74049691,119814917,193864608,
313679525,507544133,821223658,45765225,74049690,119814915,193864605,313679520,
507544125,821223645,119814916,193864606,313679522,507544128,821223650,
313679521,507544127,821223648,821223649
};

int main()
{
   int t,n;
   
   scanf("%d", &t);
   for(int i=1; i<=t; i++)
   {
      bool found = false;
      scanf("%d", &n);
      for(int j=0; j<485; j++)
         if(products[j] == n)
	   {
	      found = true;
	      printf("TAK\n");
	      break;
	   }
	if(!found)
	   printf("NIE\n");
   }
}