#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
#define rprintf(fmt, begin, end) do { const auto end_rp = (end); auto it_rp = (begin); for (bool sp_rp=0; it_rp!=end_rp; ++it_rp) { if (sp_rp) putchar(' '); else sp_rp = true; printf(fmt, *it_rp); } putchar('\n'); } while(0)

int N;
char S[200011];
char X[200011];

bool dp[200011][7];

void MAIN() {
    scanf("%d", &N);
    scanf("%s", S);
    scanf("%s", X);

    int ten = 1;
    dp[N][0] = true;

    for (int i=N; i--;) {
	int d = S[i] - '0';
	int add = 7 - (d * ten) % 7;
	add %= 7;

	if (X[i] == 'A') {
	    REP (t, 7) dp[i][t] = 1;

	    REP (t, 7) {
		if (!dp[i+1][t]) {
		    dp[i][(t+add) % 7] = 0;
		    dp[i][t] = 0;
		}
	    }
	} else {
	    REP (t, 7) {
		if (dp[i+1][t]) {
		    dp[i][(t+add) % 7] = 1;
		    dp[i][t] = 1;
		}
	    }
	}


	ten = ten * 10 % 7;
    }

    if (dp[0][0]) {
	puts("Takahashi");
    } else {
	puts("Aoki");
    }
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}


#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    int b = 7;

    int n;
    string s, x;
    cin >> n >> s >> x;

    vector<vector<int>> g(n, vector<int>(b)), h(n, vector<int>(b));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < b; j++) {
            g[i][j] = 10 * j % b;
            h[i][j] = (10 * j + s[i] - '0') % b;
        }
    }

    vector<vector<bool>> r(n + 1, vector<bool>(b, false));
    r[n][0] = true;

    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j < b; j++) {
            if (x[i] == 'A') {
                r[i][j] = r[i + 1][g[i][j]] && r[i + 1][h[i][j]];
            } else {
                r[i][j] = r[i + 1][g[i][j]] || r[i + 1][h[i][j]];
            }
        }
    }

    cout << (r[0][0] ? "Takahashi" : "Aoki") << endl;
}
