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
#include <bits/stdc++.h>

#define fi first
#define se second
#define p_b push_back
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define all(x) x.begin(),x.end()
#define sset ordered_set
#define sqr(x) (x)*(x)
#define pw(x) (1ll << x)
#define sz(x) (int)x.size()
#define fout(x) {cout << x << "\n"; return; }

using namespace std;
typedef long long ll;
typedef long double ld;
const ll N = 1e5;
const int inf = 1e8;
const ll mod = 998244353;
const ll M = 4 * N + 10;

template <typename T> void vout(T s){cout << s << endl;exit(0);}

vector <ll> cnt[2];

int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin >> n;
    string a, b;
    cin >> a >> b;

    cnt[0].resize(26);
    cnt[1].resize(26);

    for(auto i : a)cnt[0][i - 'a']++;
    for(auto i : b)cnt[1][i - 'a']++;

    if(cnt[0] == cnt[1])vout("TAK");
    else vout("NIE");

    return 0;
}