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

using namespace std;


int main(){
    std::ios::sync_with_stdio(false);

    unordered_map<string, int> counter;

    int n;
    string s;
    cin >>n;

    while (n-->0){
        cin>>s;
        counter[s]++;
    }

    if ( (counter["5A"]>=2) && (counter["5B"]>=2) && (counter["5C"]>=2) && (counter.size()==15))
        cout<<"TAK"<<endl;
    else
        cout<<"NIE"<<endl;

    return 0;
}