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

typedef long long ll;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

#define all(x) (x).begin(),(x).end()
#define debug std::cout<<"ok"<<std::endl

main ()
{
    int n;
    std::cin>>n;
    std::vector<std::vector<int> > V(5, std::vector<int> (3,0));
    V.back()=std::vector<int> (3,-1);
    while(n--)
    {
        std::string S;
        std::cin>>S;
        V[S[0]-'1'][S[1]-'A']++;
    }
    bool Z=1;
    for (auto a:V)
        for (auto b:a)
            if (b<1)
                Z=0;
    if (Z)
        std::cout<<"TAK"<<std::endl;
    else
        std::cout<<"NIE"<<std::endl;
}