1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <cstring>

using namespace std;

int main() {
    int n;
    char c;
    cin >> n;
    int a[26][2];
    int b[26][2];
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    for (int i = 0; i < n; i++) {
        cin >> c;
        a[c-'a'][i%2]++;
    }
    for (int i = 0; i < n; i++) {
        cin >> c;
        b[c-'a'][i%2]++;
    }
    cout << ((memcmp(a, b, sizeof(a)) == 0)? "TAK" : "NIE") << endl;
    return 0;
}