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

using namespace std;

int main(int argc, char** argv) {
  int wordCount;
  cin>>wordCount;

  map<int,int> m;
  for(int i=0;i<wordCount;i++) {
    string s;
    cin>>s;
    int id = (s[0]-'1')*3 + (s[1]-'A');
    m[id]++;
  }

  bool ok = true;
  for(int i=0;i<12;i++) {
    if(m[i] < 1) {
      ok = false;
      break;
    }
  }
  if(ok) {
    for(int i=12;i<15;i++) {
      if(m[i] < 2) {
        ok = false;
        break;
      }
    }
  }
  cout<<(ok?"TAK":"NIE")<<endl;
  return 0;
}