#include<bits/stdc++.h>
using namespace std;
using LL=long long;
using P=pair<int,int>;
using T=tuple<int,int,int>;
constexpr int mod=1000000007;
constexpr int inf=1e9;
constexpr double eps=1e-13;
int in(){
    int x;
    scanf("%d",&x);
    return x;
}
int main(){
    int n=in();
    string s,x;
    cin>>s>>x;
    for(int i=0;i<n;i++)s[i]-='0';
    vector<vector<int>>win(n+1,vector<int>(7));
    win[n][0]=1;
    for(int i=n-1;i>=0;i--){
        if(x[i]=='T'){
            for(int j=0;j<7;j++){
                if(win[i+1][(j*10)%7] || win[i+1][(j*10+s[i])%7])win[i][j]=1;
            }
        }
        else{
            for(int j=0;j<7;j++){
                if(win[i+1][(j*10)%7]==0 || win[i+1][(j*10+s[i])%7]==0)win[i][j]=0;
                else win[i][j]=1;
            }
        }
    }
    cout<<(win[0][0] ? "Takahashi" : "Aoki")<<endl;
    return 0;
}
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(int i=cc;i>=n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;
 
const vector<int> dx = {1, 0, -1,  0};
const vector<int> dy = {0, 1,  0, -1};
 
const vector<int> dx2 = {1, 1,  1, 0,  0, 0, -1, -1, -1};
const vector<int> dy2 = {1, 0, -1, 1, -1, 0,  1,  0, -1};
 
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;
const ll mod2 = 998244353;
 
const ll MAX = 1000000;
const ll MOD = 1000000007;
const ll big = (1ll<<60);
 
const ll moda = 1000000007;
const ll modb = 100000007;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }

ll modPow(ll a, ll n, ll p) {
  if (n == 0) return 1;
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  ll t = modPow(a, n / 2, p);
  return (t * t) % p;
}
 
ll choose(ll n, ll r, ll mod){
    ll mul = 1, div = 1;
    for(ll i = 0; i < r; i++){
        mul *= n - i;
        div *= i + 1;
        mul %= mod;
        div %= mod;
    }   
    return mul * modPow(div, mod - 2, mod) % mod;
}

int main(){
  int n;
  string s, x;
  cin >> n >> s >> x;
  vector<vector<bool>>dp(7,vector<bool>(n+1,false));//takahashi_win:true
  dp[0][n] = true;
  int digit = 1;
  rep(i, 0, n){
    int temp = (s[n-1-i]-'0');
    if(x[n-1-i]=='T'){
      rep(j, 0, 7){
        dp[j][n-i-1] = dp[(temp*digit+j)%7][n-i]||dp[j][n-i];
      }
    }else{
      rep(j, 0, 7){
        dp[j][n-i-1] = dp[(temp*digit+j)%7][n-i]&&dp[j][n-i];
      }
    }
    if(i!=n-1)(digit *= 10) %= 7;
  }
  /*
  if(x[0]=='T'){
    if(dp[(s[0]-'0')*digit%7][0]||dp[0][0]){
      cout << "Takahashi" << endl;
    }else{
      cout << "Aoki" << endl;
    }
  }else{
    if(dp[(s[0]-'0')*digit%7][0]&&dp[0][0]){
      cout << "Takahashi" << endl;
    }else{
      cout << "Aoki" << endl;
    }
  }*/
  if(dp[0][0]){
    cout << "Takahashi" << endl;
  }else{
    cout << "Aoki" << endl;
  }
  return 0;
}