1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <string>
#include <algorithm>

int main()
{
    int N;
    std::cin>>N;
    std::string s1,s2,s11,s12,s21,s22;
    std::cin>>s1>>s2;
    for (int i = 0; i < N; i++){i%2 ? s11+=s1[i] : s12+=s1[i];}
    for (int i = 0; i < N; i++){i%2 ? s21+=s2[i] : s22+=s2[i];}
    std::sort(s11.begin(), s11.end());
    std::sort(s12.begin(), s12.end());
    std::sort(s21.begin(), s21.end());
    std::sort(s22.begin(), s22.end());
    s11 == s21 and s12 == s22
        ? std::cout <<"TAK"<<std::endl
        : std::cout <<"NIE"<<std::endl;
    return 0;
}