1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include<bits/stdc++.h>
using namespace std;
string s;
int n;
map<string,int>M;
int main(){
	cin >> n;
	while(n--){
		cin >> s;
		M[s]++;
	}
	if(M["1A"]==0||M["1B"]==0||M["1C"]==0||M["2A"]==0||M["2B"]==0||M["2C"]==0||M["3A"]==0||M["3B"]==0||M["3C"]==0||M["4A"]==0||M["4B"]==0||M["4C"]==0||M["5A"]<2||M["5B"]<2||M["5C"]<2){
		cout << "NIE";
		return 0;
	}
	cout << "TAK";
	return 0;
}