1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <set>
#include <map>

int main() {
	int n;
	std::cin >> n;
	std::set<std::string> tasks;
	std::map<std::string, int> taskToCount;
	for (int i = 0; i < n; i++) {
		std::string task;
		std::cin >> task;
		tasks.insert(task);
		taskToCount[task]++;
	}
	std::cout << (tasks.size() == 15 && 
		taskToCount["5A"] >= 2 && 
		taskToCount["5B"] >= 2 &&
		taskToCount["5C"] >= 2 ? "TAK" : "NIE") << '\n';
	return 0;
}