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
34
35
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int>ap;
vector<int>an;
vector<int>bp;
vector<int>bn;
string a, b;
int main(){
    scanf("%d", &n);
    cin>>a;
    cin>>b;
    for(int i=0; i<n; i++){
        if(i%2==0){
            an.push_back(a[i]);
            bn.push_back(b[i]);
        }
        else{
            ap.push_back(a[i]);
            bp.push_back(b[i]);
        }
    }
    sort(ap.begin(), ap.end());
    sort(an.begin(), an.end());
    sort(bp.begin(), bp.end());
    sort(bn.begin(), bn.end());
    for(int i=0; i<ap.size(); i++){
        if(ap[i]!=bp[i] || an[i]!=bn[i]){
            printf("NIE");
            return 0;
        }
    }
    printf("TAK");
    return 0;
}