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 <bits/stdc++.h>
using namespace std;

unordered_map<char, int> cnt[2];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    char c;
    scanf(" %c", &c);
    cnt[i % 2][c]++;
  }
  for (int i = 0; i < n; i++) {
    char c;
    scanf(" %c", &c);
    cnt[i % 2][c]--;
  }
  for (int i = 0; i < 2; i++) {
    for (auto const& it : cnt[i]) {
      if (it.second) {
        printf("NIE\n");
        return 0;
      }
    }
  }
  printf("TAK\n");
}