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

using namespace std;

int main()
{
  int n=0;
 string zd;
 int truetab[18]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  string tab[18]={"1A","1B","1C","2A","2B","2C","3A","3B","3C","4A","4B","4C","5A","5B","5C","5A","5B","5C"};

  cin>>n;
if(n<18){
cout<<"NIE";
return 0;
}
else
{
  for(int i=0;i<n;i++)
  {
    cin>>zd;
  for(int j=0;j<18;j++)
  {
      if(tab[j]==zd&&truetab[j]==0)
      {
        truetab[j]=1;
        zd="null";
      }
   }
  }
  for(int i=0;i<18;i++)
  {
    if(truetab[i]!=1)
    {
      cout<<"NIE";
      return 0;
    }
  }
   cout<<"TAK";
}

return 0;
}