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
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>

using Klocki = std::unordered_map<char, int>;

int main()
{
    int n;
    std::cin >> n;
    Klocki p1, n1;
    for (int i = 1;i<=n;++i)
    {
        char tmp;
        std::cin >> tmp;
        if (i%2)
            n1[tmp]++;
        else 
            p1[tmp]++;
    }
    Klocki p2, n2;
    for (int i = 1;i<=n;++i)
    {
        char tmp;
        std::cin >> tmp;
        if (i%2)
            n2[tmp]++;
        else 
            p2[tmp]++;
    }
    if (p1 == p2 && n1 == n2)
        std::cout << "TAK" << std::endl;
    else
        std::cout << "NIE" << std::endl;


    return 0;
}