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
#include <iostream>
#include <string>
using namespace std;

int T[18];

int main() {
	int n, id; cin>>n;
	string s;
	for (int i=0; i<n; ++i) {
		cin>>s;
		id = (s[0]-'0')*3+(s[1]-'@')-3;
		T[id-1]++;
	}
	bool p = true;
	for (int i=0; i<12; ++i) {
		if (T[i] < 1) p = false;
	}
	for (int i=12; i<15; ++i) {
		if (T[i] < 2) p = false;
	}
	if (p) cout<<"TAK";
	else cout<<"NIE";
	
	return 0;
}