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
47
48
#include <iostream>
using namespace std;

int t[15];

int main()
{
	int n;
	cin >> n;
	string x;
	for (int i = 0;i < n;i++)
	{
		cin >> x;
		if (x == "1A") t[0]++;
		if (x == "1B") t[1]++;
		if (x == "1C") t[2]++;
		if (x == "2A") t[3]++;
		if (x == "2B") t[4]++;
		if (x == "2C") t[5]++;
		if (x == "3A") t[6]++;
		if (x == "3B") t[7]++;
		if (x == "3C") t[8]++;
		if (x == "4A") t[9]++;
		if (x == "4B") t[10]++;
		if (x == "4C") t[11]++;
		if (x == "5A") t[12]++;
		if (x == "5B") t[13]++;
		if (x == "5C") t[14]++;
	}
	for (int i = 0;i < 12;i++)
	{
		if (t[i] == 0)
		{
			cout << "NIE";
			return 0;
		}
	}
	for (int i = 12;i <= 14;i++)
	{
		if (t[i] < 2)
		{
			cout << "NIE";
			return 0;
		}
	}
	cout << "TAK";
	return 0;
}