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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define PB push_back
#define mp make_pair
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;
#define mod 1000000007
#define debug() cout<<"!XD"<<endl
int t1[28], t2[28];
int main()
{
    fastio
    int n;
    cin>>n;
    string a, b;
    cin>>a>>b;
    for(int i=1; i<=n; ++i){
        if(i%2==0){
            t1[a[i-1]-'a'+1]++;
            t1[b[i-1]-'a'+1]--;
        }
        else{
            t2[a[i-1]-'a'+1]++;
            t2[b[i-1]-'a'+1]--;
        }
    }
    bool w=true;
    for(int i=1; i<=26; ++i){
        if(t1[i]!=0 || t2[i]!=0){
            w=false;
        }
    }
    if(w){
        puts("TAK");
    }
    else{
        puts("NIE");
    }
    return 0;
}