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 <string>
#include <map>
using namespace std;

map<string, int> cnt;

int main() {
	int t;
	cin >> t;
	while(t--) {
		string a;
		cin >> a;
		cnt[a] += 1;
	}
	
	if(cnt.size() != 15) {
		cout << "NIE" << endl;
		return 0;
	}
	for(auto el: cnt) {
		if(el.first.substr(0, 1) == "5" && el.second < 2) {
			cout << "NIE" << endl;
			return 0;
		}
		if(el.first.substr(0, 1) != "5" && el.second < 1) {
			cout << "NIE" << endl;
			return 0;
		}
	}
	cout << "TAK" << endl;
	return 0;
}