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
#include <iostream>
using namespace std;
int n,w=0;
string t[100];
string s[18]={"1A", "2A", "3A", "4A", "1B", "2B", "3B", "4B", "1C", "2C", "3C", "4C", "5C", "5A", "5B", "5C", "5A", "5B"};
int main()
{std::ios_base::sync_with_stdio(0);
 cin.tie(nullptr);
 cout.tie(nullptr);
 cin>>n;
 for(int i=0; i<n; i++)
    {cin>>t[i];
    for(int j=0; j<18; j++)
    {if(t[i]==s[j])
    {s[j]="A";
     break;
    }}
     }
for(int a=0; a<18; a++)
    {if(s[a]=="1A"||s[a]=="2A"||s[a]=="3A"||s[a]=="4A"||s[a]=="1B"||s[a]=="2B"||s[a]=="3B"||s[a]=="4B"||s[a]=="1C"||s[a]=="2C"||s[a]=="3C"||s[a]=="4C"||s[a]=="5C"||s[a]=="5A"||s[a]=="5B")
    {w=1;
    break;}}
if(w==1)
cout<<"NIE";
else cout<<"TAK";
return 0;
}