#include <bits/stdc++.h>
using namespace std;

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

    vector<vector<int64_t>> memo(N, vector<int64_t>(7, -1));

    function<bool(int64_t, int64_t)> f = [&](int64_t i, int64_t j) {
      //ターンiをj(mod 7)で迎えた場合にTの勝ちであるかどうか
      if (i == N) {
          return (j == 0);
      }

      if (memo[i][j] != -1) {
          return bool(memo[i][j]);
      }

      bool l = f(i + 1, j * 10 % 7);
      bool r = f(i + 1, (j * 10 + S[i] - '0') % 7);

      bool m = (X[i] == 'T' ? l || r : l && r);

      return bool(memo[i][j] = m);
    };

    cout << (f(0, 0) ? "Takahashi" : "Aoki") << endl;
}
#include <bits/stdc++.h>
using namespace std;
// rep
#define rep(i,n)    for(decltype(n) i = 0; i < (n) ; ++i)
#define orep(i,n)   for(decltype(n) i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(decltype(n)  i = (n)-1; i >= static_cast<decltype(i)>(0); --i) // down rep
#define srep(i,s,t) for(decltype(t) i = (s); i < (t); ++i)  // set rep

// func
#define rng(x)  (x).begin(),(x).end() // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define sz(x) int((x).size()) // size

// replace
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)
#define LL_MIN std::numeric_limits<long long>::min()
#define LL_MAX std::numeric_limits<long long>::max()

// type
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vvp = vector<vp>;
using vl  = vector<ll>;
using rpq = priority_queue<int,vi,less<int>>;   // 大きい順
using pq  = priority_queue<int,vi,greater<int>>;// 小さい順

const int INF = 1001001001;
const ll LINF = 1010010011001001001;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

int main() {
  int n;cin >> n;
  string s,t;
  cin >> s >> t;

  vector<set<int>> dp(n,set<int>());
  dp.at(n-1).insert(0);
  drep(i,n) {
    if(i==0) continue;
    if(t.at(i) == 'A') {
      rep(j,7) {
        int tr = (10 * j + (s.at(i)-'0')%7) % 7 >= 0 ? (10 * j + (s.at(i)-'0')%7) % 7 : (10 * j + (s.at(i)-'0')%7) % 7 + 7;
        int sr = j * 10 % 7;
        if(dp.at(i).find(tr) != dp.at(i).end() and dp.at(i).find(sr) != dp.at(i).end()) dp.at(i-1).insert(j);
      }
    }
    else {
      for(auto r: dp.at(i)) {
        int tr = (r-(s.at(i)-'0')%7)*5 % 7 >= 0 ? (r-(s.at(i)-'0')%7)*5 % 7 : (r-(s.at(i)-'0')%7)*5 % 7 + 7;
        int sr = r * 5 % 7;
        dp.at(i-1).insert(sr);
        dp.at(i-1).insert(tr);
      }
    }
    if(dp.at(i-1).empty()) {
      cout << "Aoki" << endl;
      return 0;
    }   
  }

  if(t.at(0) == 'T') {
    if(dp.at(0).find((s.at(0) - '0') % 7) != dp.at(0).end() or dp.at(0).find(0) != dp.at(0).end()) cout << "Takahashi" << endl;
    else cout << "Aoki" << endl;
  } else {
    if(dp.at(0).find((s.at(0) -'0') % 7) == dp.at(0).end() or dp.at(0).find(0) == dp.at(0).end()) cout << "Aoki" << endl;
    else cout << "Takahashi" << endl;
  }

  

  return 0;
}
