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

int main()
{
    int n;
    map<string, int> counts;

    cin.sync_with_stdio(0);
    cin >> n;
    for(int i=0; i<n; ++i)
    {
        string pos;
        cin >> pos;
        auto it = counts.find(pos);
        if(it==counts.end())
            counts[pos] = 1;
        else
            it->second++;
    }
    if(counts.size()==15 && counts["5A"]>1 && counts["5B"]>1 && counts["5C"]>1)
    {
        cout << "TAK";
    }
    else
    {
        cout << "NIE";
    }

    return 0;
}