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
36
37
38
39
40
41
42
43
44
45
#include <iostream>

using namespace std;

int main(){

    int foo[15] = {1,1,1,1,1,1,1,1,1,1,1,1,2,2,2};

    int n;
    cin>>n;

    for(int i=0; i<n; i++){
        string ex;
        cin>>ex;

        if(ex == "1A"){foo[0]--;};
        if(ex == "1B"){foo[1]--;};
        if(ex == "1C"){foo[2]--;};
        if(ex == "2A"){foo[3]--;};
        if(ex == "2B"){foo[4]--;};
        if(ex == "2C"){foo[5]--;};
        if(ex == "3A"){foo[6]--;};
        if(ex == "3B"){foo[7]--;};
        if(ex == "3C"){foo[8]--;};
        if(ex == "4A"){foo[9]--;};
        if(ex == "4B"){foo[10]--;};
        if(ex == "4C"){foo[11]--;};
        if(ex == "5A"){foo[12]--;};
        if(ex == "5B"){foo[13]--;};
        if(ex == "5C"){foo[14]--;};

    }

    for(int i=0; i<15; i++){
        // cout<<foo[i]<<" ";
        if(foo[i]>0){
            cout<<"NIE";
            return 0;
        }
    }

    cout<<"TAK";

    return 0;
}