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
#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    string a, b, a1="", a2="", b1="", b2="";
    cin>>a;
    cin>>b;
    for(int i=0;i<(int)a.size();i++){
        if(i&1)
            a1+=a[i];
        else
            a2+=a[i];
    }

    for(int i=0;i<(int)b.size();i++){
        if(i&1)
            b1+=b[i];
        else
            b2+=b[i];
    }
    sort(b1.begin(), b1.end());
    sort(b2.begin(), b2.end());
    sort(a1.begin(), a1.end());
    sort(a2.begin(), a2.end());

    if(a1==b1 && a2==b2) cout<<"TAK";
    else cout<<"NIE";
}