#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(40)

const ll MOD = 7;
const ll INF = (ll) 1e15;

char C[2] = {'T', 'A'};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    string S, X;
    cin >> S >> X;

    ll c = 0;
    vector<bool> U(10, false);
    U[0] = true;
    ll p = 1;
    REP(i, N) {
        ll m = (S[N - 1 - i] - '0') * p % MOD;
        if (X[N - 1 - i] != C[c]) {
            c = (c + 1) % 2;
            REP(j, U.size()) {
                U[j] = !U[j];
            }
        }
        vector<bool> u(10, false);
        REP(j, U.size()) {
            u[j] = u[j] || U[j] || U[(j + m) % 7];
        }
        swap(U, u);
        p = p * 10 % MOD;
#if false
        REP(j, 7) {
            if (U[j])
                cout << "O";
            else
                cout << ".";
        }
        cout << endl;
#endif
    }

    bool aoki = false;
    if (C[c] == 'T') {
        if (!U[0])
            aoki = true;
    }
    else {
        if (U[0])
            aoki = true;
    }

    if (aoki)
        cout << "Aoki" << endl;
    else
        cout << "Takahashi" << endl;
    return 0;
}

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

int n; 
int dp[200001][8] ; 
string s, x ; 

bool fun(int idx, int num) {
	if (idx > n) return (num == 0) ; 
	int &ret = dp[idx][num] ; 
	if (ret != -1) return ret ; 
	int cur = 0 ; 
	if (x[idx] == 'A') { 
		cur = fun(idx+1, (num * 10)%7) ; 
		if (cur == 1) cur = fun(idx+1, (num * 10 + (s[idx] - '0'))%7) ; 
	}
	else {
		cur = fun(idx+1, (num * 10)%7) ; 
		if (cur == 0) cur = fun(idx+1, (num * 10 + (s[idx] - '0'))%7) ; 
	}
	return ret = cur ; 
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); 

    cin >> n >> s >> x; 
    s = "#" + s ; 
    x = "#" + x ; 
    memset(dp, -1, sizeof(dp)) ; 
    bool ok = fun(1, 0) ; 
    string ans = "Aoki" ; 
    if (ok) ans = "Takahashi" ; 
    cout << ans << endl ; 
    return 0;
}

