#include <iostream>
#include <set>
#include <string>
#include <vector>

int main() {
    int n;
    std::cin >> n;
    std::string s, x;
    std::cin >> s >> x;
    std::vector<std::set<int>> dp(n+1);
    dp[n] = {0};
    for (int i = n - 1; i >= 0; --i) {
        if (x[i] == 'A') {
            for (int j {0}; j < 7; ++j) {
                if (dp[i+1].count(((10 * j + s[i] - '0') % 7))
                    && dp[i+1].count((10 * j) % 7)) {
                    dp[i].insert(j);
                }
            }
        } else {
            for (int j {0}; j < 7; ++j) {
                if (dp[i+1].count((10 * j + s[i] - '0') % 7)
                    || dp[i+1].count((10 * j) % 7)) {
                    dp[i].insert(j);
                }
            }
        }
    }
    if (dp[0].count(0)) {
        std::cout << "Takahashi" << std::endl;
    } else {
        std::cout << "Aoki" << std::endl;
    }
}

#line 1 "/workspaces/compro/lib/template.hpp"


#line 1 "/workspaces/compro/lib/io/vector.hpp"
#include <iostream>
#include <vector>

#ifndef IO_VECTOR
#define IO_VECTOR

template <class T> std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
  int size = v.size();
  for (int i = 0; i < size; i++) {
    std::cout << v[i];
    if (i != size - 1)
      std::cout << " ";
  }
  return out;
}

template <class T> std::istream &operator>>(std::istream &in, std::vector<T> &v) {
  for (auto &el : v) {
    std::cin >> el;
  }
  return in;
}

#endif
#line 4 "/workspaces/compro/lib/template.hpp"
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}

// 重複を消す。計算量はO(NlogN)
template <class T> void unique(std::vector<T> &v) {
  std::sort(v.begin(), v.end());
  v.erase(std::unique(v.begin(), v.end()), v.end());
}


#line 2 "main.cpp"

std::string solve(long long N, string S, std::string X) {
  vector<vector<bool>> dp(N + 1, vector<bool>(7, false));
  dp[N][0] = true;
  for (int i = N - 1; i >= 0; i--) {
    REP(j, 7) {
      int m = 10 * j + (S[i] - '0'); // S[i]を選ぶ
      m %= 7;
      int m0 = 10 * j; // 0を選ぶ
      m0 %= 7;
      if (X[i] == 'T') {
        if (dp[i + 1][m0] || dp[i + 1][m]) {
          dp[i][j] = true;
        } else {
          dp[i][j] = false;
        }
      } else {
        // どっちに転んでも高橋君が勝つ場合
        if (dp[i + 1][m0] && dp[i + 1][m]) {
          dp[i][j] = true;
        } else {
          dp[i][j] = false;
        }
      }
    }
  }

  if (dp[0][0]) {
    return "Takahashi";
  } else {
    return "Aoki";
  }
}

// generated by online-judge-template-generator v4.7.1 (https://github.com/online-judge-tools/template-generator)
int main() {
  int N;
  string S, X;
  cin >> N;
  cin >> S >> X;
  auto ans = solve(N, S, X);
  cout << ans << endl;
}
