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

using namespace std;
map <string,int> M;
string S[12]={"1A","2A","3A","4A","1B","2B","3B","4B","1C","2C","3C","4C"};
string SS[3]={"5A","5B","5C"};
int main()
{
    int n;
    string s;
    cin>>n;
    for(int i=0;i<n;++i)
    {
        cin>>s;
        M[s]++;
    }
    for(int i=0;i<12;++i)
    {
        if(M[S[i]]<1)
        {
            cout<<"NIE";
            return 0;
        }
    }
    for(int i=0;i<3;++i)
    {
        if(M[SS[i]]<2)
        {
            cout<<"NIE";
            return 0;
        }
    }
    cout<<"TAK";
    return 0;
}