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

using namespace std;

int main()
{
    bool check = true;
    int ile;
    string a, b;
    int tab_a[52] = { 0 };
    int tab_b[52] = { 0 };
    cin >> ile >> a >> b;
    for (int i = 0; i < ile; i++) {
        tab_a[a[i] - 'a' + (i % 2)]++;
        tab_b[b[i] - 'a' + (i % 2)]++;
    }
    for (int i = 0; i < 52; i++) {
        if (tab_a[i] != tab_b[i]) {
            check = false;
        }
    }
    if (check) {
        cout << "TAK";
    }
    else {
        cout << "NIE";
    }
    return 0;
}