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
#define pb push_back
#define mp make_pair
#define fi first
#define se second 
#define all(...) begin(__VA_ARGS__) , end(__VA_ARGS__)
#define boost {ios_base::sync_with_stdio(false); cin.tie(); cout.tie();}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector <int> vi;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
constexpr ll nax = 2e5+6969, INF = 2e9+6969;

int n,cnt[2][30];
string S1, S2, a,b;

int main()
{
	boost;
	cin >> n >> S1 >> S2;
	bool ok = 1;
	for(int i=0;i<n;++i) 
	{
		char c = S1[i] - 'a';
		cnt[i%2][c]++;
		c = S2[i] - 'a';
		cnt[i%2][c]--;
	}
	for(int i=0;i<2;++i) for(int j=0;j<30;++j) if(cnt[i][j] != 0) ok = 0;
	//  puts(ok ? "TAK" : "NIE");
	if(ok) cout << "TAK\n";
	else cout << "NIE\n";
	return 0;
}