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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define VEC(TYPE, A, NAME, INIT) vector<TYPE> NAME(A, INIT)
#define VEC2(TYPE, A, B, NAME, INIT) vector<vector<TYPE>> NAME(A, vector<TYPE>(B, (INIT)))

#define cMOD 1000000007ULL
#define cINF ((1ll<<62)-1)
#define cINFINT ((1<<30)-1)

int main()
{
	cin.tie( 0 ); ios::sync_with_stdio( false );
    //----------------
    
    ull n;
    string s,x;
    cin >> n>>s>>x;
    vector<vector<ll>> dp( n+1, vector<ll>( 0, 0 ) );
    
    dp[n].push_back(0);
    vector<ll> a( 0, 0 );
    vector<ll> b( 0, 0 );
    set<ll> se;
    BREP(i,n)
    {
        ll m = s[i] - '0';
        if(x[i] == 'A')
        {
            a.clear();
            b.clear();
            for(auto j: dp[i+1])REP(k,7)
            {
                if((k*10+0)%7==j) a.push_back(k);
                if((k*10+m)%7==j) b.push_back(k);
            }
            sort(ALL(a));
            sort(ALL(b));
            //REP( j, a.size() ) cout << a[j] << " "; cout << endl;
            //REP( j, b.size() ) cout << b[j] << " "; cout << endl;
            
            set_intersection( ALL( a ), ALL( b ), back_inserter( dp[i] ) );
        }
        else
        {
            se.clear();
            for(auto j: dp[i+1])REP(k,7)
            {
                if((k*10+0)%7==j) se.emplace(k);
                if((k*10+m)%7==j) se.emplace(k);
            }
            for(auto j: se) dp[i].push_back(j);
        }
        
        //REP( j, dp[i].size() ) cout << dp[i][j] << " "; cout << endl;
    }

    cout << 
    (find(ALL(dp[0]), 0)==dp[0].end()
    ? "Aoki" : "Takahashi") << endl;
    
    //----------------
    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;
}
