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
#include <iostream>
using namespace std;

int t[15];
int main() {
    int n; 
    string s;
    cin>>n;

    for(int i = 0; i < n; i++) {
        cin>>s;
        t[(s[0]-'0' - 1)*3 + (s[1]-'A')]++;
    }
    bool ok = true;
    for(int i = 0; i <15;i++){
        if(i<12)if(t[i]<1)ok = false;
        if(i>=12)if(t[i]<2)ok = false;
    }
    if(ok){
        cout<<"TAK\n";
    }else{
        cout<<"NIE\n";
    }

    return 0;
}