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

using namespace std;

map<string, int> mp;
vector<string> tab = {"1A", "1B", "1C", "2A", "2B", "2C", "3A", "3B", "3C", "4A", "4B", "4C", "5A", "5B", "5C"};
vector<int> tab2 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2};

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    for (int i=0; i<n; ++i){
        string x;
        cin >> x;
        ++mp[x];
    }
    bool good = 1;
    for (int i=0; i<15; ++i) {
        if (mp[tab[i]] < tab2[i]){
            good = 0;
        }
            
    }
    if (good) cout << "TAK";
    else cout << "NIE";
}