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

using namespace std;

#ifdef USE_CERR_LOG
#define LOG if (true) cerr
const bool LogEnabled = true;
#else
#define LOG if (false) cerr
const bool LogEnabled = false;
#endif

bool LogBigEnabled = true;

#ifdef USE_FILE_CIN
ifstream fin("zad0.in");
#define cin fin
#endif


typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;


int main() {
    int n;
    string idea;
    map<string, int> counts;
    
    cin >> n;
    
    while (n--) {
        cin >> idea;
        counts[idea] ++;
    }
    
    if (counts.size() < 15) {
        cout << "NIE";
    } else if (counts["5A"] > 1 && counts["5B"] > 1 && counts["5C"] > 1) {
        cout << "TAK";
    } else {
        cout << "NIE";
    }
    
	return 0;
}