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
#include <bits/stdc++.h>//Krzysztof Łukasiewicz
using namespace std;


using LL = long long int;
using uLL = unsigned long long int;
using uint = unsigned int;
using ld = long double;

map <string, int> M;

int main(){
	cin.tie(NULL);
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		string a;
		cin >> a;
		M[a]++;
	}
	for(char day = '1'; day <= '5'; day++){
		for(char letter = 'A'; letter <= 'C'; letter++){
			string x = {day, letter};\
			if(M[x] == 0){
				cout << "NIE\n";
				return 0;
			}
			if(day == '5' && M[x] < 2){
				cout << "NIE\n";
				return 0;
			}
		}
	}
	cout << "TAK\n";
	
	
	return 0;
}