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 <bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define N 100010
#define deb 0

using namespace std;

/*
    OwO! *notices you are looking at my code~* Have a nice day! INI_OK 100

    Przepraszam :(
*/

int ile['C'+2]['5'+2]; ///tak, az tak mi sie nie chce

int main()
{
    if(!deb){
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    }


    int n;
    char r, k;/// r-> runda   k-> kasta
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> r >> k;
        ile[k][r]++;
        if(deb) printf("NOWY: R:%c K:%c\n", r, k);
    }

    for(k='A'; k<='C'; k++)
    {
        for(r='1'; r<='5'; r++)
        {
            if(deb) printf("TYP: R:%c K:%c == %d\n", r, k, ile[k][r]);
            if(r<'5' && ile[k][r]<1 || r=='5' && ile[k][r]<2)
            {
                cout << "NIE";
                return 0;
            }
        }
    }
    cout << "TAK";
    return 0;
}