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
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

#define f first
#define s second

const int MAXN = 313;

int t[MAXN][2];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    string s1, s2;
    cin >> n >> s1 >> s2;
    for (int i = 0; i < n; i++) {
        t[s1[i]][i % 2]++;
        t[s2[i]][i % 2]--;
    }
    for (int i = 0; i < MAXN; i++) {
        if (t[i][0] != 0 || t[i][1] != 0) {
            cout << "NIE";
            return 0;
        }
    }
    cout << "TAK";
    return 0;
}