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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <bits/stdc++.h>
using namespace std;

#define debug if(0)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

int n, nr;
string s;
map <string, int> zadanie = {{"1A", 0}, {"2A", 0}, {"3A", 0}, {"4A", 0}, {"5A", 0}, {"1B", 0}, {"2B", 0}, {"3B", 0}, {"4B", 0}, {"5B", 0}, {"1C", 0}, {"2C", 0}, {"3C", 0}, {"4C", 0}, {"5C", 0}};

int main() {
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n;
    
    for (int i = 1; i <= n; ++i) {
        cin >> s;
        ++zadanie[s];
    }
    
    for (auto it = zadanie.begin(); it != zadanie.end(); ++it) {
        ++nr;
        
        if (nr <= 12 && it->ss < 1) {
            puts ("NIE");
            return 0;
        } else if (nr > 12 && it->ss < 2) {
            puts ("NIE");
            return 0;
        }
    }
    
    puts ("TAK");

    return 0;
}
/*
19
3B 4B 5B 4C 5C 3C 1A 5A 5C 3A 5A 2C 1B 2A 5B 5C 2B 1C 4A

20
2B 4B 4C 5A 5C 5C 4A 1B 3A 4A 2A 3B 1B 1C 1A 5A 2C 1B 5B 3C
*/