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
#include <bits/stdc++.h>
using namespace std;
map<string, int> m;
int n;
string s;
int main() {
	ios_base::sync_with_stdio(0);
	cin>>n;
	for(int i = 0; i < n; ++i) {
		cin>>s;
		m[s]++;
	}
	if(m.size() < 15) {
		cout<<"NIE\n";
		return 0;
	}
	for(auto const& [key, val] : m) {
		if(key[0] == '5' && val < 2) {
			cout<<"NIE\n";
			return 0;
		}
	}
	cout<<"TAK\n";
	return 0;
}