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
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
map<string, int> M;
int main() {
	ios_base::sync_with_stdio(0);
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> s;
		M[s]++;
	}
	string res = "TAK";
	if(!M["1A"]) res = "NIE";
	if(!M["1B"]) res = "NIE";
	if(!M["1C"]) res = "NIE";

	if(!M["2A"]) res = "NIE";
	if(!M["2B"]) res = "NIE";
	if(!M["2C"]) res = "NIE";

	if(!M["3A"]) res = "NIE";
	if(!M["3B"]) res = "NIE";
	if(!M["3C"]) res = "NIE";

	if(!M["4A"]) res = "NIE";
	if(!M["4B"]) res = "NIE";
	if(!M["4C"]) res = "NIE";

	if(M["5A"] < 2) res = "NIE";
	if(M["5B"] < 2) res = "NIE";
	if(M["5C"] < 2) res = "NIE";

	cout << res;
}