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
38
39
40
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

string in, out;
int s;

int cnt_in[30][2], cnt_out[30][2];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    cin >> s;
    cin >> in >> out;

    for (int i = 0; i < s; i++)
    {
        cnt_in[in[i] - 'a'][i % 2]++;
        cnt_out[out[i] - 'a'][i % 2]++;
    }

    for (int i = 0; i < 26; i++)
    {
        if (cnt_in[i][0] != cnt_out[i][0] || cnt_in[i][1] != cnt_out[i][1])
        {
            cout << "NIE\n";
            return 0;
        }
    }

    cout << "TAK\n";
}