1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
    cin >> n;
    map<char, int> m1,m2;
    map<char, bool> check;
    for(int i=0;i<n;i++) {
        char c; cin >> c; m1[c] += 1;
    }
    for(int i=0;i<n;i++) {
        char c; cin >> c; m2[c] += 1;
        if( m2[c] == m1[c] ) check[c] = true;
        else check[c] = false;
    }
    bool OK=true;
    for( auto ce : check ) {
        if ( !ce.second ) OK=false;
    }
    if ( OK && n % 2 != 0 ) cout << "TAK";
    else cout << "NIE";
}