#include <iostream> int count[15], n, c; void f(std::string s) { int hash = (s[0] - '1') * 3 + s[1] - 'A'; if(++count[hash] == (s[0] == '5' ? 2 : 1)) c++; } int main() { std::string s; std::cin >> n; while(n--) std::cin >> s, f(s); std::cout << (c == 15 ? "TAK" : "NIE") << '\n'; return 0; } /* 19 3B 4B 5B 4C 5C 3C 1A 5A 5C 3A 5A 2C 1B 2A 5B 5C 2B 1C 4A 20 2B 4B 4C 5A 5C 5C 4A 1B 3A 4A 2A 3B 1B 1C 1A 5A 2C 1B 5B 3C */
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include <iostream> int count[15], n, c; void f(std::string s) { int hash = (s[0] - '1') * 3 + s[1] - 'A'; if(++count[hash] == (s[0] == '5' ? 2 : 1)) c++; } int main() { std::string s; std::cin >> n; while(n--) std::cin >> s, f(s); std::cout << (c == 15 ? "TAK" : "NIE") << '\n'; return 0; } /* 19 3B 4B 5B 4C 5C 3C 1A 5A 5C 3A 5A 2C 1B 2A 5B 5C 2B 1C 4A 20 2B 4B 4C 5A 5C 5C 4A 1B 3A 4A 2A 3B 1B 1C 1A 5A 2C 1B 5B 3C */ |