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

int main() {
//ios_base::sync_with_stdio(0);
string r[15] = {"1A","1B","1C","2A","2B","2C","3A","3B","3C","4A","4B","4C","5A","5B","5C"};
int z[15] = {1,1,1,1,1,1,1,1,1,1,1,1,2,2,2};
map<string, int> rundy;
int n, i;
string runda;
for(i = 0; i < 15; i++){
	rundy[r[i]] = 0;}

cin >> n;
for(i = 0; i < n; i++){
	cin >> runda;
	rundy[runda]++;
}
i = 0;
for(map<string,int>::iterator it = rundy.begin(); it != rundy.end();it++,i++){
	//cout << it->first <<" " <<it->second << endl;
	if(it->second < z[i]) {
		cout <<"NIE";
		return 0;
	}
}
cout <<"TAK";
	return 0;
}