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 <bits/stdc++.h>
#define boost                                                                  \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define debug(x) cerr << #x << " " << x << endl
#define ll long long
#define st first
#define nd second
using namespace std;
const int N = 1e6 + 130;
multiset<char> bajtusSet[2], bitusSet[2];
int n, t;
string bajtus, bitus;

int main() {
  boost;
  cin >> n >> bitus >> bajtus;

  for (int i = 0; i < n; i++) {
    bajtusSet[i % 2].insert(bajtus[i]);
    bitusSet[i % 2].insert(bitus[i]);
  }
  if (bajtusSet[0] == bitusSet[0] && bajtusSet[1] == bitusSet[1]) {
    cout << "TAK\n";
  } else {
    cout << "NIE\n";
  }
}