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 <iostream>

int main() {
  int c;
  std::cin >> c;
  std::string a, b;
  int odd[26], even[26];
  for (int i = 0; i < 26; ++i) {
    odd[i] = 0;
    even[i] = 0;
  }
  std::cin >> a >> b;
  for (int i = 0; i < c; ++i) {
    if (i % 2) {
      odd[a[i] - 'a']++;
      odd[b[i] - 'a']--;
    }
    else {
      even[a[i] - 'a']++;
      even[b[i] - 'a']--;
    }
  }
  bool good = true;
  for (int i = 0; i < 26; ++i)
    if (odd[i] || even[i]) good = false;
  std::cout << (good ? "TAK" : "NIE") << std::endl;
  return 0;
}