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
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int Sum1[2][256];
int Sum2[2][256];

int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        char s;
        scanf(" %c", &s);
        Sum1[i % 2][s]++;
    }
    for (int i = 0; i < n; i++) {
        char s;
        scanf(" %c", &s);
        Sum2[i % 2][s]++;
    }
    for (int i = 0; i < 256; i++) {
        if (Sum1[0][i] != Sum2[0][i] || Sum1[1][i] != Sum2[1][i])
        {
            printf("NIE");
            return 0;
        }
    }
    printf("TAK");
    return 0;
}