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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <iostream>
#include <sstream>
#include <string>
#include <set>
using namespace std;

main (int arc, char ** argv) {

    int n = 0;
    cin >> n;
    //cout << n << '\n';

    int zad5A = 0;
    int zad5B = 0;
    int zad5C = 0;

    set<string> zadania;
    for (int i = 0; i < n; i++)
    {
        string str;
        cin >> str;
        //cout << str << '\n';

        if (str == "5A") {
            if (zad5A == 0) {zad5A++;} else {zadania.insert(str);}
            //cout << "str:" << str << '\n';
        } else {
            if (str == "5B") {
                if (zad5B == 0) {zad5B++;} else {zadania.insert(str);}
                //cout << "str:" << str << '\n';
            } else {
                if (str == "5C") {
                    if (zad5C == 0) {zad5C++;} else {zadania.insert(str);}
                    //cout << "str:" << str << '\n';
                } else {zadania.insert(str);}
            }
        }

        if ((zad5A == 1) && (zad5B == 1) && (zad5C == 1) && (zadania.size() == 15)) {
            cout << "TAK" << '\n';
            return 0;

        }
        //cout << "zadania.size()" << zadania.size() <<'\n';

    }
 
    cout << "NIE" << '\n';
    //cout << "zadania.size()" << zadania.size() <<'\n';
    return 0;
}