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

int data[2][2][30];
char A[300100];
char B[300100];

bool check() {
  for (int p = 0; p < 2; p++)
    for (int i = 0; i < 26; i++)
      if (data[0][p][i] != data[1][p][i]) return 0;
  return 1;
}

int main() {
  int n;
  scanf("%d %s %s", &n, A, B);

  for (int i = 0; i < n; i++) {
    data[0][i & 1][A[i] - 'a']++;
    data[1][i & 1][B[i] - 'a']++;
  }

  if (check()) {
    printf("TAK\n");
  } else {
    printf("NIE\n");
  }

  return 0;
}