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

using namespace std;
map<std::string, int> m;
std::string l[15]={"1A","2A","3A","4A","5A","1B","2B","3B","4B","5B","1C","2C","3C","4C","5C"};
int main()
{
    int n;
    cin >> n;

    string s;
    for(;n>0;n--)
    {
        cin>>s;
        m[s]++;
    }
    for(int i=0;i<15;i++)
        if(m[l[i]]<1)
        {
            cout<<"NIE";
            return 0;
        }
    if(m["5A"]<2 or m["5B"]<2 or m["5C"]<2)
    {
        cout<<"NIE";
        return 0;
    }
    cout<<"TAK";
    return 0;
}