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
#include <iostream>
#include <string>
#include <map>

int main() {
    int n = 0;
    std::cin >> n;

    std::map<std::string, int> data;

    for (int i = 0; i < n; ++i) {
        std::string s;
        std::cin >> s;

        data[s]++;
    }

    if (data.size() != 15 || data["5A"] < 2 || data["5B"] < 2 || data["5C"] < 2) {
        std::cout << "NIE" << std::endl;
    } else {
        std::cout << "TAK" << std::endl;
    }

    return 0;
}