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 <set>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<string> v;
    while (n--) {
        string s;
        cin >> s;
        v.push_back(s);
    }
    vector<string> target = {"1A", "1B", "1C", "2A", "2B", "2C",
                             "3A", "3B", "3C", "4A", "4B", "4C",
                             "5A", "5A", "5B", "5B", "5C", "5C"};
    sort(v.begin(), v.end());
    int t = 0;
    for (int i = 0; i < v.size(); i++) {
        if (target[t] == v[i]) {
            t++;
        }
    }
    if (t == target.size()) {
        cout << "TAK";
    } else {
        cout << "NIE";
    }
    return 0;
}