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 <cstdio>

int cnt[2][30];

int main() {
    int N;

    scanf("%d\n",&N);

    for (int i=0; i<N; ++i) {
        char c;
        scanf("%c", &c);
        cnt[i%2][c-'a']++;
    }
    scanf("\n");

    for (int i=0; i<N; ++i) {
        char c;
        scanf("%c", &c);
        if (cnt[i%2][c-'a'] == 0) {
            printf("NIE\n");
            return 0;
        }
        cnt[i%2][c-'a']--;
    }

    printf("TAK\n");
    return 0;
}