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
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
import java.io.*;

class ilo {

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

	    System.exit(0);
     }
}