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
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <vector>

int main() {
    int n;
    std::cin >> n;
    std::vector<int> np1(26);
    std::vector<int> p1(26);
    std::vector<int> np2(26);
    std::vector<int> p2(26);
    for(int i = 0; i < n; i++) {
        if(i%2==0) {
            char c;
            std::cin >> c;
            np1[c - 'a']++;
        }
        else {
            char c;
            std::cin >> c;
            p1[c - 'a']++;
        }
    }
    for(int i = 0; i < n; i++) {
        if(i%2==0) {
            char c;
            std::cin >> c;
            np2[c - 'a']++;
        }
        else {
            char c;
            std::cin >> c;
            p2[c - 'a']++;
        }
    }
    for (int i = 0; i < 26; ++i) {
        if(np1[i] != np2[i] || p1[i] != p2[i]) {
            std::cout << "NIE" << "\n";
            return 0;
        }
    }
    std::cout << "TAK" << "\n";
    return 0;
}