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 <map>

int main();
int main(){
    std::map<std::string, int> occ {{"1A", 1},{"2A", 1},{"3A", 1},{"4A", 1},{"5A", 2},{"1B", 1},{"2B", 1},{"3B", 1},{"4B", 1},{"5B", 2},{"1C", 1},{"2C", 1},{"3C", 1},{"4C", 1},{"5C", 2},
    };
    std::string token;
    int num;

    std::cin >> num;
    for(int x=0; x<num; x++){
        std::cin >> token;
        occ[token]--;
    }

    for(auto x: occ){
        if(x.second > 0){
            std::cout << "NIE" << std::endl;
            return 0;
        }
    }
    std::cout << "TAK" << std::endl;
    return 0;
}