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
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    vector <int> arr;
    for (int i = 0; i <= 12; i++)
        arr.push_back(1);
    for (int i = 0; i < 3; i++)
        arr.push_back(2);

    int tests, licz = 18;
    cin >> tests;
    while (tests--) {
        string temp;
        cin >> temp;
        int id = (temp[0] - '1') * 3 + (temp[1] - 'A' + 1);
        if (arr[id] > 0) {
            licz--;
            arr[id]--;
        }
    }
    if (!licz)
        cout << "TAK\n";
    else 
        cout << "NIE\n";
}