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

map<string, int> myMap;
string str;
int n;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> str;
        myMap[str]++;
    }
    if (myMap["1A"] >= 1 && myMap["1B"] >= 1 && myMap["1C"] >= 1 &&
            myMap["2A"] >= 1 && myMap["2B"] >= 1 && myMap["2C"] >= 1 &&
            myMap["3A"] >= 1 && myMap["3B"] >= 1 && myMap["3C"] >= 1 &&
            myMap["4A"] >= 1 && myMap["4B"] >= 1 && myMap["4C"] >= 1 &&
            myMap["5A"] >= 2 && myMap["5B"] >= 2 && myMap["5C"] >= 2) {
        cout << "TAK\n";
    }
    else {
        cout << "NIE\n";
    }
}