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>

void read(int* as, int n) {
  char c;
  for(int i = 0; i < n; i++) {
    std::cin >> c;
    as[int(c-'a')] += 1;
  }
}

int main() {
  int n;
  std::ios::sync_with_stdio(false);
  std::cin >> n;
  int as[26] = {0};
  int bs[26] = {0};
  read(as, n);
  read(bs, n);

  bool yep = true;
  for(int i = 0; i < 26 && yep; i++) {
    yep = as[i] == bs[i];
  }

  std::cout << (yep ? "TAK" : "NIE") << std::endl;

  return 0;
}