#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define M 1000000007

int n;
string s,x;

// bool rec(int a, int r){
// 	if(a==n){
// 		if(r==0)
// 			return 1;
// 		else
// 			return 0;
// 	}
// 	else if(x[a]=='T'){
// 		return rec(a+1,(10*r)%7) || rec(a+1,(10*r+s[a]-'0')%7);
// 	}
// 	else{
// 		return rec(a+1,(10*r)%7) && rec(a+1,(10*r+s[a]-'0')%7);
// 	}
// }

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

	
	cin >> n >> s >> x;
	// if(rec(0,0))
	// 	cout << "Takahashi";
	// else
	// 	cout << "Aoki";

	bool dp[n+1][7];

	for(int i=0; i<=n; i++)
		for(int j=0; j<7; j++)
			dp[i][j] = 0;

	dp[n][0] = 1;
	for(int i=n-1; i>=0; i--)
		for(int j=0; j<7; j++){
			if(x[i]=='T')
				dp[i][j] = dp[i+1][(10*j)%7] || dp[i+1][(10*j + s[i]-'0')%7];
			else
				dp[i][j] = dp[i+1][(10*j)%7] && dp[i+1][(10*j + s[i]-'0')%7];
		}

	if(dp[0][0])
    	cout << "Takahashi";
	else
		cout << "Aoki";
    

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

typedef pair<int,int> pii;
typedef pair<string,int> psi;
typedef pair<int,string> pis;
typedef array<int,2> aii;
typedef array<int,3> aiii;
typedef array<int,4> aiiii;
typedef unsigned long long ull;
typedef long long int ll;
typedef array<ll,2> all;
typedef array<ll,3> alll;
typedef array<ll,4> allll;

#define pb push_back
#define ff first
#define ss second
#define MAX 200005
#define MOD 1000000007
#define INF 1e9+100
vector<aii>adj[MAX];
vector<int> dijkstra_dag_adj[MAX];
int xMove[] = { 0,1,0,-1,1,1,-1,-1, 2, 2, -2, -2, 1, 1, -1, -1 };
int yMove[] = { 1,0,-1,0,1,-1,1,-1, 1, -1, 1, -1, 2, -2, 2, -2 };
int n;
string s,x;
int dp[MAX][8];
int solve(int i, int r)
{
    if(i==n)
        return r==0?2:1;
    if(dp[i][r]!=-1)
        return dp[i][r];

    int ans=0;
    if(x[i]=='A')
    {
        int cur=solve(i+1,(r*10+s[i]-48)%7);
        if(cur!=1)
            cur=solve(i+1,(r*10+0)%7);
        ans=cur;
    }
    else
    {
        int cur=solve(i+1,(r*10+s[i]-48)%7);
        if(cur!=2)
            cur=solve(i+1,(r*10+0)%7);
        ans=cur;
    }

    return dp[i][r]=ans;
}
int main()
{
    //freopen("input.in","r",stdin);
    //freopen("output.txt","w",stdout);
    cin.tie(0),cout.tie(0);
    ios_base::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);
    int TC=1;
    int m,k,q;
    //cin>>TC;
    for(int t1=1; t1<=TC; t1++)
    {
        cin>>n>>s>>x;

        memset(dp,-1,sizeof dp);

        int ans=solve(0,0);
        if(ans==1)
            cout<<"Aoki\n";
        else cout<<"Takahashi\n";

    }
    return 0;
}
