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 <iostream>

using namespace std;

int main()
{
    long n, zabawki[26][2], i;
    string s;

    for (i = 0; i < 26; i++)
            zabawki[i][0] = zabawki[i][1] = 0;

    cin >> n;
    cin >> s;
    for (i = 0; i < n; i++) 
        zabawki[(int)s[i] - 97][i % 2] ++;
    cin >> s;
    for (i = 0; i < n; i++)
        zabawki[(int)s[i] - 97][i % 2] --;

    for (i = 0; i < 26; i++)
        if (zabawki[i][0] != 0 || zabawki[i][1] != 0) { cout << "NIE"; return 0; }

    cout << "TAK";

    return 0;
}