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
#include <iostream>
#include <set>

int main() {
		unsigned short n;
		std::cin >> n;
		
		if (n < 18) {
				std::cout << "NIE\r\n";
				return 0;
		}
		unsigned short a5 = 0, b5 = 0, c5 = 0;
		std::set<std::string> exercises;
		
		for (int i = 0; i < n; ++i) {
				std::string line;
				std::cin >> line;
				if (line == "5A") a5++;
				if (line == "5B") b5++;
				if (line == "5C") c5++;
				exercises.insert(line);
		}

		if(exercises.size() >= 15 && a5 >= 2 && b5 >= 2 && c5 >= 2) {
				std::cout << "TAK\r\n";
		} else {
				std::cout << "NIE\r\n";
		}
}