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
#include <iostream>

using namespace std;

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    unsigned n;
    cin >> n;
    string a, b;
    cin >> a >> b;
    int arr[26][4] = {0};
    for (unsigned i = 0; i < n; i++) {
        arr[a[i] - 'a'][2 * (i % 2)]++;
        arr[b[i] - 'a'][2 * (i % 2) + 1]++;
    }
    for (unsigned i = 0; i<26; i++) {
        if (arr[i][0] != arr[i][1] || arr[i][2] != arr[i][3]) {
            cout << "NIE" << '\n';
            return 0;
        }
    }
    cout << "TAK" << '\n';
    return 0; 
}