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
30
31
32
#include <iostream>
#include <string>

using namespace std;

int n = 0;
int req[3][5] = { {1, 1 ,1, 1, 2}, {1, 1 ,1, 1, 2}, {1, 1 ,1, 1, 2} };

int main() {
	string w;
	cin >> n;
	while (n--) {
		cin >> w;
		req[w[1] - 'A'][w[0] - '1']--;
	}

	bool bad = false;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 5; j++) {
			if (req[i][j] > 0) {
				bad = true;
			}
		}
	}
	if (bad) {
		cout << "NIE\n";
	} else {
		cout << "TAK\n";
	}

	return 0;
}