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
import java.io.*;

import static java.lang.Math.*;

public class ilo {
    public static void main(String[] args) throws IOException {
        FastStream str = new FastStream();

        int t = str.readInt();
        int n = 0;
        double omega1 = 0;
        double omega2 = 0;
        boolean isFib = false;
        long sqrt1 = 0;
        long sqrt2 =0;
        while (t > 0) {
            n = str.readInt();
            omega1 = 5 * pow(n, 2) + 4;
            omega2 = 5 * pow(n, 2) - 4;
            sqrt1 = (long)sqrt(omega1);
            sqrt2 = (long)sqrt(omega2);
            isFib = (sqrt1*sqrt1 == omega1) || (sqrt2*sqrt2 == omega2);
            if(isFib) str.append("TAK\n");
            else str.append("NIE\n");
            t--;
        }
        str.closeOutput();
    }
}

class FastStream {
    private BufferedInputStream inputStr;
    private PrintWriter outputStr;

    public FastStream() {
        inputStr = new BufferedInputStream(System.in);
        outputStr = new PrintWriter(System.out);
    }

    public static void main(String[] args) throws IOException {
        FastStream fs = new FastStream();
        double startTime = System.currentTimeMillis();
        for (int i = 0; i < 1000; i++) {
            System.out.println(fs.readInt());
        }
        double stopTime = System.currentTimeMillis();
        double elapsedTime = stopTime - startTime;
        System.out.println("\nElapsed time " + elapsedTime);
    }

    public int readInt() {
        int output = 0;
        int bytesRead;
        try {
            do {
                bytesRead = inputStr.read();
                if ((bytesRead != '\n') && (bytesRead != '\r') && (bytesRead != ' ') && (bytesRead != -1)) {
                    output += bytesRead - '0';
                    output *= 10;
                }
            } while (bytesRead != '\n' && bytesRead != ' ');
        } catch (IOException e) {
            e.printStackTrace();
        }
        return output / 10;
    }
   public String readLine() throws IOException {
        StringBuilder stringBuffer = new StringBuilder();
        char inChar;
        try {
            do {
                inChar = (char) inputStr.read();
                if ((inChar != '\n') & (inChar != '\r'))
                    stringBuffer.append(inChar);
            } while ((inChar != '\n') & (inChar != '\r'));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return stringBuffer.toString();
    }

    public void flushedWrite(String str) {
        outputStr.write(str);
        outputStr.flush();
    }

    public void append(String str) {
        outputStr.write(str);
    }
    public void unflushedWriteInt(int i) {
        outputStr.println(i);
    }

    public void flushOutput() {
        outputStr.flush();
    }

    public void closeOutput() {
        outputStr.close();
    }

    public void closeInput() {
        try {
            inputStr.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}