#include "bits/stdc++.h"

using namespace std;

const int N = 2e5 + 5;

char s[N], x[N];
int dp[N][7];

int n;

int solve (int pos, int rem) {
  if (pos == n) {
    return rem == 0;
  }
  int &ret = dp[pos][rem];
  if (ret != -1) {
    return ret;
  }
  ret = 1;
  int dig = s[pos] - '0';
  int hi = solve(pos + 1, (10 * rem + dig) % 7);
  int bi = solve(pos + 1, (10 * rem) % 7);
  if (x[pos] == 'A') {
    ret = 1;
    if (hi == 0 || bi == 0) {
      ret = 0;
    }
  } else {
    ret = 0;
    if (hi == 1 || bi == 1) {
      ret = 1;
    }
  }
  return ret;
}

int main() {
  scanf("%d", &n);
  scanf("%s", s);
  scanf("%s", x);
  memset(dp, -1, sizeof dp);
  int lol = solve(0, 0);
  lol ? puts("Takahashi") : puts("Aoki");
  return 0;
}

#include <iostream>
using namespace std;

int main()
{
    int n;
    cin >> n;
    string s, x;
    cin >> s >> x;
    bool b[7]{0};
    b[0] = true;
    for(int i = n - 1; i > 0; i--){
        bool c[7];
        if(x[i] == 'T'){
            for(int j = 0; j < 7; j++){
                c[j] = false;
                for(int k = 0; k < 7; k++){
                    if(!b[k]) continue;
                    if((j * 10 + s[i] - '0' - k) % 7 == 0) c[j] = true;
                    if((j * 10 - k) % 7 == 0) c[j] = true;
                }
            }
        }
        else{
            for(int j = 0; j < 7; j++){
                c[j] = true;
                for(int k = 0; k < 7; k++){
                    if(b[k]) continue;
                    if((j * 10 + s[i] - '0' - k) % 7 == 0) c[j] = false;
                    if((j * 10 - k) % 7 == 0) c[j] = false;
                }
            }
        }
        swap(b, c);
    }
    if(x[0] == 'T'){
        if(b[0] || b[s[0] - '0']) cout << "Takahashi" << endl;
        else cout << "Aoki" << endl;
    }
    else{
        if(!b[0] || !b[s[0] - '0']) cout << "Aoki" << endl;
        else cout << "Takahashi" << endl;
    }
}
