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
#include <bits/stdc++.h>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n;
	unordered_map<string, int> mp;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		mp[s]++;
	}

	if (n < 18)
	{
		cout << "NIE\n";
		return 0;
	}

	else
	{
		if ((mp["1A"])&&(mp["2A"])&&(mp["3A"])&&(mp["4A"])&&(mp["1B"])&&(mp["2B"])&&(mp["3B"])&&(mp["4B"])&&(mp["1C"])&&(mp["2C"])&&(mp["3C"])&&(mp["4C"])&&(mp["5A"]>1)&&(mp["5B"]>1)&&(mp["5C"]>1))
		{
			cout << "TAK\n";
		}
		else cout << "NIE\n";
	}
	
	return 0;
}