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

int n, p1[30], p2[30], n1[30], n2[30];
char a;

int main(){
   ios_base::sync_with_stdio(0);
   cin.tie(NULL); cout.tie(NULL);
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a;
        if(i%2==0){
            p1[a-'a']++;
        } else {
            n1[a-'a']++;
        }
    }
    for(int i=0; i<n; i++){
        cin >> a;
        if(i%2==0){
            p2[a-'a']++;
        } else {
            n2[a-'a']++;
        }
    }
    for(int i=0; i<26; i++){
        if(p1[i]!=p2[i] || n1[i]!=n2[i]){
            cout << "NIE";
            return 0;
        }
    }
    cout << "TAK";
}