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
#include <iostream>
#include <string.h>

int main()
{
    int n, count[2][2][26];
    char c;
    memset(count, 0, sizeof(int) * 2 * 2 * 26);
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        std::cin >> c;
        count[0][i % 2][c - 'a']++;
    }
    for (int i = 0; i < n; ++i) {
        std::cin >> c;
        count[1][i % 2][c - 'a']++;
    }
    for (int i = 0; i < 26; ++i) {
        if (count[0][0][i] != count[1][0][i] || count[0][1][i] != count[1][1][i]) {
            std::cout << "NIE" << std::endl;
            return 0;
        }
    }
    std::cout << "TAK" << std::endl;
    return 0;
}