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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ilo {
	private static int FIBO_CNT = 45;
	private static String YES = "TAK";
	private static String NO = "NIE";
	
	private static long fibo[] = new long[FIBO_CNT];
	
	private static void prepareFibo(int n) {
		if (n == 0) fibo[n] = 0;
		if (n == 1) fibo[n] = 1;
		if (n > 1) {
			fibo[n] = fibo[n - 2] + fibo[n - 1];
		}
	}
	
	private static void prepareFibo() {
		for (int i = 0; i < FIBO_CNT; i++) {
			prepareFibo(i);
		}
	}
	
	private static String check(long value) {
		for (int a=0; a < FIBO_CNT; a++) {
			for (int b=0; b < FIBO_CNT; b++) {
				if (fibo[a] * fibo[b] == value) {
					return YES;
				}
			}
		}
		
		return NO;
	}
	
	public static void main(String[] args) throws IOException {
		int size = 0;
		long values[] = new long[10];
		
		prepareFibo();
		
	    BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in));
	    String s = bufferRead.readLine();
	    
		size = Integer.parseInt(s);
 
	    for (int i = 0; i < size; i ++) {
	    	s = bufferRead.readLine();
	    	values[i] = Long.parseLong(s);
	    }
		
		for (int i = 0; i < size; i ++) {
			System.out.println(check(values[i]));			
		}
				
		System.out.flush();

		System.exit(0);
	}
}