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
#include <bits/stdc++.h>

using namespace std;

int main () {
 int ideas;
 cin>>ideas;
 int numbers[3][5] = {
{0,0,0,0,-1},
{0,0,0,0,-1},
{0,0,0,0,-1}
};
 for (size_t i = 0; i < ideas; i++) {
   string tmp;
   cin>>tmp;
   numbers[tmp[1]-'A'][tmp[0]-'0'-1]++;
 }
 bool possible = true;
 for (size_t i = 0; i < 3; i++) {
   for (size_t j = 0; j < 5; j++) {
     //cout<<numbers[i][j]<<" ";
     if(numbers[i][j]<1) {
       possible = false;
       break;
     }
   }
   //cout<<endl;
 }
 if(possible) {
   cout<<"TAK";
 } else {
   cout<<"NIE";
 }
}