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
//var`
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main(){
    int n;
    string temp, change, temp_p = "", temp_np = "", change_p = "", change_np = "";
    cin>>n>>temp>>change;
    for (int i=0; i<n; ++i){
        if((i+1)%2 == 0){
            temp_p += temp[i];
            change_p += change[i];
        }else{
            temp_np += temp[i];
            change_np += change[i];
        }
    }
    std::sort(&temp_p[0], &temp_p[temp_p.size()]);
    std::sort(&temp_np[0], &temp_np[temp_np.size()]);
    std::sort(&change_p[0], &change_p[change_p.size()]);
    std::sort(&change_np[0], &change_np[change_np.size()]);
    if (temp_p == change_p && temp_np == change_np){
        cout<<"TAK";
    }else{
        cout<<"NIE";
    }
    return 0;
}