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

int n;
char round, level;
int tasks[18];

int main() {
	scanf("%d\n", &n);
	for (int i=0; i<n;i++) {
		scanf("%c%c ", &round, &level);
		tasks[3*(round - 49) + (level - 65)]++;
	}

	for (int i=0;i<15;i++) {
		if (i > 11) {
			if (tasks[i] < 2) {
				printf("NIE\n");
				return 0;
			}
		}else if (tasks[i] < 1) {
			printf("NIE\n");
			return 0;
		}
	}
	printf("TAK\n");
	return 0;
}