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

using namespace std;

int main() {
    int n;
    cin >> n;
    string s1, s2;
    cin >> s1 >> s2;
    
    std::map<std::pair<char, bool>, int> m1, m2;

    for (int i = 0; i < n; ++i) {
        m1[make_pair(s1[i], i%2)]++;
    }

    for (int i = 0; i < n; ++i) {
        m2[make_pair(s2[i], i%2)]++;
    }

    if (m1 == m2) cout << "TAK\n";
    else cout << "NIE\n";
}