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
43
44
45
46
47
48
49
50
51
#include<bits/stdc++.h>
#define MAXN 1000*1000+1
using namespace std; 
  
int n;
string s1,s2;

map<char,int> s1p,s2p,s1np,s2np;

int main() 
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    
	
	cin>>n>>s1>>s2;
	    
    for(int i = 0;i<n;i++)
    	{
    		if((i+1) % 2 == 0)
    		{
				s2p[s2[i]]++;
    			s1p[s1[i]]++;
    		}
    		else
    			{
    				s1np[s1[i]]++;
    				s2np[s2[i]]++;
				}
    		
		}
    
    bool ok = true;
    for(char i = 'a';i<='z';i++)
    	{
		if(s1p[i] != s2p[i])
			ok = false;
		}
    for(char i = 'a';i<='z';i++)
    	{
    		if(s1np[i] != s2np[i])
    			ok = false;
		}
	if(ok)
		cout<<"TAK"<<endl;
	else
		cout<<"NIE"<<endl;
	
		
    return 0; 
}