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
#include <stdio.h>

char p1[300004];
char p2[300004];

#define D ('z'-'a'+1)

int takich[D][2];

int main() {
    int i, n;
    scanf("%d\n", &n);
    fgets(p1, 300003, stdin);
    fgets(p2, 300003, stdin);
//    printf(">>%d<<\n>>%s<<\n>>%s<<\n", n, p1, p2);
    for(i=0;i<D;i++) {
        takich[i][0] = takich[i][1] = 0;
    }
    for(i=0;i<n;i++) {
        takich[p1[i]-'a'][i&1]++;
        takich[p2[i]-'a'][i&1]--;
    }
    for(i=0;i<D;i++) {
        if ((takich[i][0]!=0) || (takich[i][1] != 0)) {
            printf("NIE\n");
            return 0;
        }
    }
    printf("TAK\n");
    return 0;    
}