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
#include <iostream>
#include <algorithm>

using namespace std;

string bit,baj,bit2[2],baj2[2];

int main()
{
    ios_base::sync_with_stdio(false);
    int n;
    bit2[0]="";
    bit2[1]="";
    baj2[0]="";
    baj2[1]="";
    cin >> n >> bit >> baj;
    for(int i=0; i<n; ++i){
        bit2[i&1]+=bit[i];
        baj2[i&1]+=baj[i];
    }
    sort(bit2[0].begin(),bit2[0].end());
    sort(bit2[1].begin(),bit2[1].end());
    sort(baj2[0].begin(),baj2[0].end());
    sort(baj2[1].begin(),baj2[1].end());
    if(bit2[0]==baj2[0] && bit2[1]==baj2[1]) cout << "TAK";
    else cout << "NIE";
    return 0;
}