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

#define st first
#define nd second
#define iamspeed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

string s;
int n, res;
map<string, int> mp;

int main()
{
    iamspeed;
    mp["1A"] = mp["2A"] = mp["3A"] = mp["4A"] = mp["1B"] = mp["2B"] = mp["3B"] = mp["4B"] = mp["1C"] = mp["2C"] = mp["3C"] = mp["4C"] = 1;
    mp["5A"] = mp["5B"] = mp["5C"] = 2;
    cin >> n;

    for(int i = 1 ; i <= n ; i++)
    {
        cin >> s;
        if(mp[s] != 0)
        {
            res++;
            mp[s]--;
        }
    }
    if(res == 18)
    {
        cout << "TAK" << endl;
    }
    else
    {
        cout << "NIE" << endl;
    }
}