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

using namespace std;

vector<int> fibs;

int main() {
    int t, a=1, b=2, divs;
    while(b<=1000000000){
      fibs.push_back(b);
      t = a+b;
      a = b;
      b = t;
    }

    scanf("%d", &t);
    while(t--) {
      divs = 0;
      scanf("%d", &a);
      for (int i = 0; i < fibs.size()  && a > 1 && fibs[i] <= a && divs < 2; ++i) {
          while(a%fibs[i] == 0 && a > 1 && divs < 2){
              a/=fibs[i];
              divs++;
          }
      }
      printf("%s\n", a>1?"NIE":"TAK");
    }
    return 0;
}