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

int A[26][2];
int B[26][2];

int main() {
    std::ios_base::sync_with_stdio(0);
    int n;
    std::cin >> n;
    std::string a,b;
    std::cin >> a >> b;
    for (int i=0;i<n;++i) {
        int aa = a[i]-'a';
        A[aa][i&1]++;
        int bb = b[i]-'a';
        B[bb][i&1]++;
    }
    bool result = true;
    for (int i=0;i<26;++i) {
        result &= A[i][0] == B[i][0];
        result &= A[i][1] == B[i][1];
    }
    std::cout << (result ? "TAK" : "NIE") << std::endl;
    return 0;
}