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

int main()
{
    std::ios_base::sync_with_stdio(0);
    unsigned n;
    std::cin >> n;
    std::string sequence1, sequence2;
    std::cin >> sequence1 >> sequence2;
    unsigned dupadupa[26][2] = {{0}};
    unsigned dupadupadupa[26][2] = {{0}};
    for (unsigned i = 0; i < sequence1.size(); i++)
    {
        dupadupa[sequence1[i] - 'a'][i % 2]++;
    }
    for (unsigned i = 0; i < sequence2.size(); i++)
    {
        dupadupadupa[sequence2[i] - 'a'][i % 2]++;
    }
    for (unsigned i = 0; i < 2; i++)
        for (unsigned j = 0; j < 26; j++)
        {
            if (dupadupa[j][i] != dupadupadupa[j][i])
            {
                std::cout << "NIE";
                return 0;
            }
        }
    std::cout << "TAK";
    return 0;
}