1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <algorithm>
#include <string>
#include <map>

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n;
    std::string bit, baj;
    std::cin >> n >> bit >> baj;
    
    std::map<char, int> cm1, cm2, co1, co2;
    for (auto i = 0; i < n; i += 2) {
        cm1[bit[i]]++;
        cm2[baj[i]]++;
        co1[bit[i + 1]]++;
        co2[baj[i + 1]]++;
    }
    bool isOk = cm1 == cm2 && co1 == co2;
    
    std::cout << (isOk ? "TAK\r\n" : "NIE\r\n");
}