#include <sys/time.h>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

int tCanWin(int pos, int m);
int aCanWin(int pos, int m);

char s[200000+10];
char x[200000+10];
int n;

int memo1[200000+10][10];
int memo2[200000+10][10];
int tCanWin(int pos, int m) {
  int &res = memo1[pos][m];
  if(res < 0){
    if(pos == n) {
      res = m == 0 ? 1 : 0;
    } else {
      if(x[pos] == 'A') {
        res = !aCanWin(pos, m);
      } else {
        int r1 = tCanWin(pos+1, m*10 % 7);
        int r2 = tCanWin(pos+1, (m*10+(s[pos]-'0')) % 7);
        res = r1 || r2;
      }
    }
  }
  return res;
}

int aCanWin(int pos, int m) {
  int &res = memo2[pos][m];
  if(res < 0){
    if(pos == n) {
      res = m == 0 ? 0 : 1;
    } else {
      if(x[pos] == 'T') {
        res = !tCanWin(pos, m);
      } else {
        int r1 = aCanWin(pos+1, m*10 % 7);
        int r2 = aCanWin(pos+1, (m*10+(s[pos]-'0')) % 7);
        res = r1 || r2;
      }
    }
  }
  return res;
}

int main(void) {
  scanf("%d%s%s", &n, s, x);
  memset(memo1, -1, sizeof memo1);
  memset(memo2, -1, sizeof memo2);
  int res = tCanWin(0, 0);
  cout << (res ? "Takahashi" : "Aoki") << endl;
  
  return 0;
}

#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; using ll = long long; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    string S, X;
    cin >> N >> S >> X;

    constexpr int Mod = 7;
    array<bool, Mod> A = {}, B = A;
    B[0] = true;

    for (int i = N - 1; i >= 0; --i) {
        if (X[i] == 'T') {
            rep(a, Mod) {
                int u = (a * 10 + (S[i] - '0')) % Mod;
                int v = (a * 10 + 0) % Mod;
                A[a] = B[u] || B[v];
            }
        }
        else {
            rep(a, Mod) {
                int u = (a * 10 + (S[i] - '0')) % Mod;
                int v = (a * 10 + 0) % Mod;
                A[a] = B[u] && B[v];
            }
        }
        swap(A, B);
    }

    write(B[0] ? "Takahashi" : "Aoki");
}
