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

int32_t main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    map<string,int> mp;
    for(int i=0;i<n;i++) {
        string str;
        cin >> str;
        mp[str]++;
    }
    for(string c : {"A","B","C"}) {
        for(int i=1;i<=4;i++) {
            if(mp[to_string(i)+c] == 0) {
                cout<<"NIE\n";
                return 0;
            }
        }
    }
    if(mp["5A"] >= 2 && mp["5B"] >= 2 && mp["5C"] >= 2)
        cout<<"TAK\n";
    else cout<<"NIE\n";
}