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
30
31
32
33
34
35
36
#include <ctime>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
const int MAXN = 500000;

#define FOR(i, n) for(int i = 0, __n = (n); i < __n; i++)

char A1[MAXN];
char A2[MAXN];
int P[2]['z'-'a'+1];


int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  cin >> A1 >> A2;


  FOR(i, n) {
    P[i%2][A1[i]-'a']++;
    P[i%2][A2[i]-'a']--;
  }

  bool ok = true;
  FOR (i, 'z'-'a'+1) {
    if(P[0][i] != 0 || P[1][i] != 0) ok = false;
  }
  if (ok) cout << "TAK" << endl;
  else cout << "NIE" << endl;
}