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
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define repeat(i, x) for (int i = 0; i < (x); ++i)

int main()
{
    fastIO;
    
    int n;
	cin >> n;

    vector<vector<int>> a(4, vector<int>(26));
    
    repeat(i, 2)
    {
    	bool par = false;
    	
    	repeat(j, n)
    	{
    		char ch;
    		cin >> ch;
    		
    		++a[par + 2 * i][ch - 'a'];
    		
    		par ^= 1;
    	}
    }
    			
    cout << (a[0] == a[2] && a[1] == a[3] ? "TAK" : "NIE");
    

    return 0;
}