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
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define PB push_back
#define mp make_pair
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;
#define mod 1000000007
#define debug() cout<<"!XD"<<endl
map<string, int> code;
int check[22];
int main()
{
    fastio
    int n;
    string s;
    cin>>n;
    code["1A"]=1;
    code["1B"]=2;
    code["1C"]=3;

    code["2A"]=4;
    code["2B"]=5;
    code["2C"]=6;

    code["3A"]=7;
    code["3B"]=8;
    code["3C"]=9;

    code["4A"]=10;
    code["4B"]=11;
    code["4C"]=12;

    code["5A"]=13;
    code["5B"]=14;
    code["5C"]=15;
    for(int i=1; i<=n; ++i){
        cin>>s;
        check[code[s]]++;
    }
    bool aw=true;
    for(int i=1; i<=15; ++i){
        if(i<13 && check[i]<1){
            aw=false;
        }
        else if(i>12 && check[i]<2){
            aw=false;
        }
    }
    if(aw){
        puts("TAK");
    }
    else{
        puts("NIE");
    }
    return 0;
}