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

map <string, int> liczba;
map <string, int> :: iterator it;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int j = 0, n;
    string a;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a;
        liczba[a]++;
    }
    for(it = liczba.begin(); it != liczba.end(); it++){
        if(it->first == "5C" || it->first == "5B" || it->first == "5A"){
            if(it->second < 2){
                cout << "NIE" << '\n';
                return 0;
            }
        }
        j++;
    }
    if(j < 15){
        cout << "NIE" << '\n';
        return 0;
    }
    cout << "TAK" << '\n';
    return 0;
}