// RioTian 21/03/15
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 10;
int dp[N][7];
int main() {
    ios_base::sync_with_stdio(false), cin.tie(0);
    int n;
    string s, t;
    cin >> n >> s >> t, s = " " + s, t = " " + t;
    dp[n][0] = 1;
    for (int i = n; i >= 1; --i) {
        for (int j = 0; j < 7; ++j) {
            int a = dp[i][(j * 10 + s[i] - '0') % 7];
            int b = dp[i][j * 10 % 7];
            if (t[i] == 'A') dp[i - 1][j] = a & b;
            else
                dp[i - 1][j] = a | b;
        }
    }
    cout << (dp[0][0] ? "Takahashi\n" : "Aoki\n");
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
const  int N=2e5+10;
bool f[N][7];
int X[N];
char op[N];
int n;
int qpow(int p,int q){
	int ans=1;
	while(q){
		if(q&1)ans=ans*p%7;
		q>>=1;
		p=p*p%7;		
	}
	return ans;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>n;
	char cc;
	for(int i=1;i<=n;++i){
		cin>>cc;
		X[i]=(cc-'0')*qpow(10,n-i)%7;
	}
	cin>>(op+1);
	f[n][0]=1;
	for(int i=n-1;i>=0;i--){
		if(op[i+1]=='A'){
			for(int j=0;j<7;++j){
				if((f[i+1][(j+X[i+1])%7])&&(f[i+1][j]))f[i][j]=1;
			}
		}
		else{
			for(int j=0;j<7;++j){
				if(f[i+1][(j+X[i+1])%7]||f[i+1][j])f[i][j]=1;
			}
		}
	}
	if(f[0][0])cout<<"Takahashi\n";
	else cout<<"Aoki\n";

    return 0;
}