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
#include <bits/stdc++.h>
using namespace std;
 
 
 
 
 
 
int main(){ 


	int n;
	cin >> n;
	
	
	vector<vector<int>> T(5, vector<int>(3));
	
	for(int x = 0; x < n; x ++){
		string s;
		cin >> s;
		T[s[0] - 1 - '0'][s[1] - 'A'] ++;
	}

	bool pos = true;
	
	for(int x = 0; x < 4; x ++){
		for(int y = 0; y < 3; y ++){
			if(T[x][y] == 0)
				pos = false;
		}
	}
 	
 	if(T[4][0] >1 and T[4][2] >1 and T[4][1] >1 and pos)
	 	cout << "TAK";
	else
		cout << "NIE";
 	
 	
 	
 }//}