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

using namespace std;

int n;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string aa,bb,a[2],b[2];
    cin>>n>>aa>>bb;
    for(int i=1; i<=n; i++)
    {
        a[i%2].push_back(aa[i-1]);
        b[i%2].push_back(bb[i-1]);
    }
    sort(a[0].begin(),a[0].end());
    sort(b[0].begin(),b[0].end());
    sort(a[1].begin(),a[1].end());
    sort(b[1].begin(),b[1].end());
    if(a[0]==b[0]&&a[1]==b[1])
        cout<<"TAK";
    else
        cout<<"NIE";
    return 0;
}