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
//============================================================================
// Name        : PA.cpp
// Author      : Hanczar
// Version     :
// Copyright   : Zombies are everywhere!
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <stdint.h>
#include <vector>

static uint32_t getFibb(uint32_t fF,uint32_t sF) {
  return fF+sF;
}

static std::vector<uint32_t> fibb;

static void init(void) {
  fibb.push_back(0);
  fibb.push_back(1);
  while ((fibb.back()) < 2000000000) {
    uint32_t pos = fibb.size();
    fibb.push_back(getFibb(fibb[pos-2],fibb[pos-1]));
  }
}

int main() {
  uint32_t n;
  std::ios_base::sync_with_stdio(false);
  init();

  std::cin >> n;
  do {
    bool result = false;
    uint32_t val;
    std::cin >> val;

    for (int i=0;i<fibb.size() && !result && fibb[i] <= val;++i) {
      for (int j=0;j<fibb.size();++j) {
        uint64_t mul = fibb[i] * fibb[j];
        if (val == mul) {
          result = true;
          break;
        }
        if (mul > val) {
          break;
        }
      }
    }

    std::cout << (result?"TAK":"NIE") << std::endl;

  } while (--n);

	return 0;
}