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
//Author: Piotr Zielinski
#include <bits/stdc++.h>

using namespace std;

map<string, int> m;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int n;
    string s;
    cin >> n;

    while(n --> 0) {
        cin >> s;
        m[s]++;
    }

    if(m.size() == 15 && m["5A"] >= 2 && m["5B"] >= 2 && m["5C"] >= 2)
        cout << "TAK\n";
    else
        cout << "NIE\n";
    return 0;
}