1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include <bits/stdc++.h>
using namespace std;

int main() {
  std::map<std::string, int> rounds;
  int n;
  cin >> n;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    rounds[s]++;
  }
  cout << ((rounds.size() == 15 && rounds["5A"] >= 2 && rounds["5B"] >= 2 &&
            rounds["5C"] >= 2)
               ? "TAK"
               : "NIE")
       << endl;
}