1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    set< string > S;
    multiset< string > P;
    for (int i = 0; i < n; ++i) {
        string s; cin >> s;
        S.insert(s);
        P.insert(s);
    }
    cout << (S.size() == 15 and P.count("5A") >= 2 and P.count("5B") >= 2 and P.count("5C") >= 2? "TAK" : "NIE") << '\n';
}