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 <bits/stdc++.h>
using namespace std;
multiset<pair<char, int> > S;

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin>>n;
    string s, t;
    cin>>s;
    for(int i=0; i<n; ++i){
        S.insert({s[i], i%2});
    }
    cin>>t;
    for(int i=0; i<n; ++i){
        pair<char, int> cur={t[i], i%2};
        if(S.find(cur)!=S.end()){
            S.erase(S.find(cur));
        }
        else{
            cout<<"NIE\n";
            return 0;
        }
    }
    cout<<"TAK\n";
    return 0;
}