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>
using namespace std;
#define REP(i,n) for(int _n=(n), i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define TRACE(x) cerr << "TRACE(" #x ")" << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << endl;
typedef long long LL; typedef unsigned long long ULL;

using Counts = std::array<std::array<int, 26>, 2>;

Counts read_and_count(size_t len) {
  string text;
  cin >> text;
  assert(text.size() == len);
  Counts counts = {};
  REP(i, len) ++counts[i&1][text[i]-'a'];
  return counts;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  size_t len; cin >> len;
  Counts a = read_and_count(len);
  Counts b = read_and_count(len);
  cout << (a == b ? "TAK\n" : "NIE\n");
}