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
#include<bits/stdc++.h>
using namespace std;
int arr[69];
int main(){
	int n,i,a,l;
	char c;
	scanf("%d",&n);
	l=0;
	for(i=0;i<n;i++){
		scanf("%d %c",&a,&c);
		if(a!=5){
			arr[a*3+c-'A']++;
			if(arr[a*3+c-'A']==1)
				l++;
		}
		else{
			arr[a*3+c-'A']++;
			if(arr[a*3+c-'A']==2)
				l++;
		}
	}
	if(l==15)
		printf("TAK\n");
	else
		printf("NIE\n");
	return 0;
}