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
36
37
38
39
40
41
#include <stdio.h>
#include <map>
#include <string>
#include <iostream>

using namespace std;

int main(){


    long long int number;
    scanf("%lld\n", &number);
    string toys1, toys2;
    cin >> toys1 >> toys2;
    int res1 [26];
    int res2 [26];
    for (int idx = 0; idx < 26; ++idx) {
        res1[idx] = 0;
        res2[idx] = 0;
    }

    for (int idx=0; idx < number; ++idx) {
        if (idx % 2 == 0) {
            res1[toys1[idx] - 'a'] ++;
            res1[toys2[idx] - 'a'] --;
        } else {
            res2[toys1[idx] - 'a'] ++;
            res2[toys2[idx] - 'a'] --;
        }
    }


    for (int idx = 0; idx < 26; ++idx) {
        if (res1[idx] != 0 || res2[idx] != 0) {
            printf("NIE\n");
            return 0;
        }
    }
    printf("TAK\n");
    return 0;
}