1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<cstdio>

char input[300300];
int counter[26][2];
int n;

bool solve()
{
    for (int i = 0; i < 26; ++i) if (counter[i][0] || counter[i][1]) return false;
    return true;
}

int main()
{
    scanf("%d", &n);
    scanf("%s", input);
    for (int i = 0; i < n; ++i) counter[input[i] - 'a'][i & 1]++;
    scanf("%s", input);
    for (int i = 0; i < n; ++i) counter[input[i] - 'a'][i & 1]--;
    printf("%s\n", solve() ? "TAK" : "NIE");
    return 0;
}