#include <bits/stdc++.h>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define debug(output) cout<<#output<<"= "<<output<<endl
using lint = long long;
typedef pair<int,int> P;
const lint linf=1e18+7;
const lint inf=1e9+7;
const int MOD=1000000007;
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
signed main(){
  int n;cin>>n;
  string s;cin>>s;
  string x;cin>>x;
  vector<int> a(n);
  rep(i,n)a[i]=s[i]-'0';
  int m=7;
  int rev=modinv(10,7);
  reverse(s.begin(),s.end());
  reverse(x.begin(),x.end());
  reverse(a.begin(),a.end());
  vector<int> dp(m,0);
  dp[0]=1;
  rep(i,n){
    vector<int> nxt(m,0);
    if(x[i]=='T'){
      rep(j,m){
        if(dp[j]){
          nxt[(j*rev+m*2-a[i])%m]+=dp[j];
          nxt[(j*rev)%m]+=dp[j];
        }
      }
    }
    else{
      rep(j,m){
        if(dp[j]==0){
          nxt[(j*rev+m*2-a[i])%m]+=1;
          nxt[(j*rev)%m]+=1;
        }
      }
      rep(j,m){
        if(nxt[j]>0)nxt[j]=0;
        else nxt[j]=1;
      }
    }
    swap(dp,nxt);
    rep(j,m)dp[j]=min(dp[j],1);
  }
  if(dp[0]>0){
    cout<<"Takahashi"<<endl;
  }
  else{
    cout<<"Aoki"<<endl;
  }
  return 0;
}
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,dp[N][7];
char s[N],x[N];
int main()
{
    scanf("%d%s%s",&n,s+1,x+1);
    dp[n][0]=1;
    for(int i=n;i>=1;i--){
        if(x[i]=='A'){
            for(int j=0;j<7;j++){
                if(dp[i][10*j%7]&&dp[i][(10*j+s[i]-'0')%7])
                    dp[i-1][j]=1;
            }
        }
        else{
            for(int j=0;j<7;j++){
                if(dp[i][10*j%7]||dp[i][(10*j+s[i]-'0')%7])
                    dp[i-1][j]=1;
            }
        }
    }
    if(dp[0][0]) cout<<"Takahashi"<<endl;
    else cout<<"Aoki"<<endl;
    system("pause");
    return 0;
}