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
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int  n, pair_int;
    char pair_char;
    vector < pair < int, char > > vect;
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> pair_int >> pair_char;
        vect.push_back(std::make_pair(pair_int, pair_char));
    }
    auto p = make_pair(3, 'B');
    
    for (int i = 1; i <= 5; i++) {
        for (char j = 'A'; j <= 'C'; j++) {
            auto p = make_pair(i, j);
            if (i != 5) {
                if (count(vect.begin(), vect.end(), p) >= 1) {
                }
                else
                {
                    cout << "NIE";
                    return 0;
                }
            }
            else {
                if (count(vect.begin(), vect.end(), p) >= 2) {
                }
                else
                {
                    cout << "NIE";
                    return 0;
                }
            }
        }
    }

    cout << "TAK";

    return 0;
}