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
#include <iostream>
#include <set>



int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);

  std::set<std::string> zwykle;
  int piate[3] = {0, 0, 0};
  int n;
  std::cin >> n;
  for(int i = 0; i < n; i++) {
    std::string curr;
    std::cin >> curr;
    if(curr[0] == '5') {
      piate[curr[1] - 'A']++;
    }
    else {
      zwykle.insert(curr);
    }
  }
  if(zwykle.size() == 12 && piate[0] > 1 && piate[1] > 1 && piate[2] > 1) {
    std::cout << "TAK\n";
  }
  else {
    std::cout << "NIE\n";
  }
}