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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
	int n;
	string pos;

	cin >> n;

	vector<int> cnt(5 * 3, 1);

	for (int i = 4 * 3; i < cnt.size(); ++i)
	{
		++cnt[i];
	}

	for (int i = 0; i < n; ++i)
	{
		cin >> pos;

		int ind = (pos[0] - '1') * 3 + (pos[1] - 'A');
		--cnt[ind];
	}

	bool res = true;

	for (int i = 0; i < cnt.size(); ++i)
	{
		if (cnt[i] > 0)
		{
			res = false;
			break;
		}
	}

	if (res)
		cout << "TAK" << endl;
	else
		cout << "NIE" << endl;

	return 0;
}