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
#include <bits/stdc++.h>
using namespace std;

constexpr int nax = 3e5;

int n, zl[2][256];

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

    cin >> n;

    for (int i = 0; i < 2; ++i) {
        string s; cin >> s;
        for (int j = 0; j < s.size(); ++j)
            zl[j & 1][s[j]] += (i? -1 : 1);
    }

    for (int i = 0; i < 2; ++i)
        for (int j = 'a'; j <= 'z'; ++j)
            if (zl[i][j])
                return cout << "NIE" << '\n', 0;

    cout << "TAK" << '\n';
}