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
#include <cstdio>
using namespace std;

const int MAX_N = 300000;

char str1[MAX_N+10];
char str2[MAX_N+10];
size_t size;

int letters['z'-'a'+1][2];

int main()
{
    int n;
    scanf("%d", &n);
    scanf("\n%s\n%s", str1, str2);
    for (int i=0; i<n; ++i) {
        ++letters[str1[i] - 'a'][i % 2];
        --letters[str2[i] - 'a'][i % 2];
    }
    bool result = true;
    for (int i=0; 'a'+i<='z' && result; ++i) {
        result = letters[i][0] == 0 and letters[i][1] == 0;
    //    fprintf(stderr, "[%c] => %d, %d\n", 'a'+i, letters[i][0], letters[i][1]);
    }
    printf("%s\n", (result ? "TAK" : "NIE"));
    return 0;
}