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
#include <iostream>
#include <map>
#include <string>

using namespace std;

int main()
{
	int n;
	cin >> n;
	map<string,int> mapa;
	int counter = 0;
	for(int i=0;i<n;i++)
	{
		string s;
		cin >> s;
		if(mapa.find(s) != mapa.end())
		{
			mapa[s]++;
			if(s[0] == '5' && mapa[s] == 2)
				counter++;
		}
		else
			mapa.emplace(s,1);
	}
	
	if(mapa.size() == 15 && counter == 3)
		cout << "TAK" << endl;
	else
		cout << "NIE" << endl;
	
	return 0;
}