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>

using namespace std;

int main()
{
    int n;
    set<string> challenges;
    set<string> remainingChallenges;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string idea;
        cin >> idea;
        if (!challenges.insert(idea).second && idea.rfind('5', 0) == 0) {
            remainingChallenges.insert(idea);
        }
    }
    if ((challenges.size() + remainingChallenges.size()) == 18)
    {
        cout << "TAK"<<endl;
    }
    else
    {
        cout << "NIE"<<endl;
    }
    return 0;
}