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>
#include <string>
#include <utility>
#include <map>

char t[300007];

int cnt[300][2];

int main() {
  int n;
  scanf("%d", &n);
  for (int p = 0; p < 2; ++p) {
    int add = (p == 0 ? -1 : 1);
    scanf("%s", t);
    for (int i = 0; i < n; ++i) {
      cnt[t[i]][i%2] += add;
    }
  }
  bool ok = true;
  for (int i = 'a'; i <= 'z'; ++i) {
    if (cnt[i][0] != 0 || cnt[i][1] != 0) {
      ok = false;
      break;
    }
  }
  printf("%s\n", ok ? "TAK" : "NIE");
  return 0;
}