#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<set>

using namespace std;

typedef long long LL;

const int N = 200010;

int n;
char a[N], player[N];
int w[N];


int f[N][7];
int dfs(int u, int k)
{
    if(f[u][k] != -1)  return f[u][k];
    if(u == n)
    {
        if(player[u] == 'T')
        {
            if((k + w[u]) % 7 == 0)  return f[u][k] = 1;
            if(k % 7 == 0)  return f[u][k] = 1;
            return f[u][k] = 0;
        }
        else
        {
            if((k + w[u]) % 7)  return f[u][k] = 0;
            if(k % 7)  return f[u][k] = 0;
            return f[u][k] = 1;
        }
    }
    
    if(player[u] == 'T')
    {
        if(dfs(u + 1, (k + w[u]) * 10 % 7))  return f[u][k] = 1;
        if(dfs(u + 1, k * 10 % 7))  return f[u][k] = 1;
        return f[u][k] = 0;
    }
    else
    {
        if(!dfs(u + 1, (k + w[u]) * 10 % 7))  return f[u][k] = 0;
        if(!dfs(u + 1, k * 10 % 7))  return f[u][k] = 0;
        return f[u][k] = 1;
    }
}

int main()
{
    scanf("%d%s%s", &n, a + 1, player + 1);
    for(int i = 1; i <= n; i ++)  w[i] = a[i] - '0';
    
    memset(f, -1, sizeof f);
    if(dfs(1, 0))  puts("Takahashi");
    else  puts("Aoki");
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define fastio                  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define input_output            freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 

template <typename Arg1>
void prn(Arg1&& arg1) { cout<<arg1<<"\n";}
template <typename Arg1, typename... Args>
void prn(Arg1&& arg1, Args&&... args) { cout<<arg1<<" "; prn(args...); }

template <typename Arg1>
void prs(Arg1&& arg1) { cout<<arg1<<" ";}
template <typename Arg1, typename... Args>
void prs(Arg1&& arg1, Args&&... args) { cout<<arg1<<" "; prs(args...); }

template <typename Arg1>
void read(Arg1&& arg1) { cin>>arg1; }
template <typename Arg1, typename... Args>
void read(Arg1&& arg1, Args&&... args) { cin>>arg1; read(args...); }

#define int                     long long
#define all(ds)                 ds.begin(), ds.end()
#define uniq(v)                 (v).erase(unique(all(v)),(v).end())
#define gcd(x,y)                __gcd(x,y)
#define rep(i,a,b)              for(int i=a;i<b;i++)
#define precise(x)              cout<<fixed<<setprecision(x)
#define endl                    "\n"

const long long INF = 1e18;
const int32_t MOD = 1e9+7;
const int N = 5e5+5;

int n, m, k, q, r, l, x, y, z;
int a[N], b[N], c[N];
string s, t;
int ans = 0;

void solve(){
    int n;
    string s, x;
    read(n,s,x);
    vector<int>dp(7);
    dp[0] = 1;
    int ten = 1;
    for(int i = n-1; i >= 0; --i){
        vector<int> old(7);
        swap(old, dp);
        // rem = (rem*10)%7;
        for(int j = 0; j < 7; ++j){
            int nj = (ten * (s[i]-'0') + j)%7;
            if(x[i] == 'T'){
                dp[j] = old[j] | old[nj];
            }
            else{
                dp[j] = old[j] & old[nj];
            }
        }
        ten = (ten*10)%7;
    }
    if(dp[0] == 1) {
        prn("Takahashi");
    }
    else{
        prn("Aoki");
    }

    
    
}

signed main()
{
#ifndef ONLINE_JUDGE  
    input_output  
#else   
    fastio
#endif

#ifdef SIEVE
    sieve();
#endif

#ifdef NCR
    init();
#endif

    int t = 1;
    // cin>>t;
    while(t--){
        solve();
    }

    return 0;
}