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
#include <iostream>
using namespace std;

int n, a1[26], a2[26], b1[26], b2[26];

int main() {    
    cin >> n;
    for (int i=0; i<n; i++) {
        char z;
        cin >> z;
        i%2 == 0 ? a1[z-'a']++ : a2[z-'a']++;
    }
    for (int i=0; i<n; i++) {
        char z;
        cin >> z;
        i%2 == 0 ? b1[z-'a']++ : b2[z-'a']++;
    }
    for (int i=0; i<26; i++) {
        if (a1[i] != b1[i]) {
            cout << "NIE" << endl;
            return 0;
        }
    }
    for (int i=0; i<26; i++) {
        if (a2[i] != b2[i]) {
            cout << "NIE" << endl;
            return 0;
        }
    }
    cout << "TAK" << endl;
    return 0;
}