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
37
#include <bits/stdc++.h>
#define rep(a, b) for(int a = 0; a < b; ++a)

using namespace std;
typedef long long ll;


const ll MAX = 26;
ll  even[MAX],  odd[MAX];

bool check() {
    rep(i, MAX) if (even[i] != 0 || odd[i] != 0) return false;
    return true;
}

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

    char c;
    rep(i, n) {
        cin >> c;
        if (i & 1) odd[(int)c - 'a']++;
        else even[(int)c - 'a']++;
    }

    rep(i, n) {
        cin >> c;
        if (i & 1) odd[(int)c - 'a']--;
        else even[(int)c - 'a']--;
    }


    if (check()) cout << "TAK";
    else cout << "NIE";
}