1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std; 


int main(){
    int n;
    string S1, S2; 
    cin>>n>>S1>>S2; 
    vector <int> A[2], B[2]; 
    for (int i = 0; i < n; i++){
        A[i%2].push_back(S1[i]); 
        B[i%2].push_back(S2[i]);
    }
    sort (A[0].begin(), A[0].end()); 
    sort (A[1].begin(), A[1].end()); 
    sort (B[0].begin(), B[0].end()); 
    sort (B[1].begin(), B[1].end()); 

    if (A[0] == B[0] && A[1] == B[1])
        cout<<"TAK"<<endl; 
    else cout<<"NIE"<<endl; 
}