#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define per(i, a, b) for (auto i = (b); i-- > (a); )
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) int((x).size())
#define lb(x...) lower_bound(x)
#define ub(x...) upper_bound(x)

template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	ll ans = 1;
	int n; cin >> n;
	ll p = 1;
	rep(i, 0, n) {
		string s; cin >> s;
		p <<= 1;
		if (s[0] != 'A') ans |= p;
	}
	cout << ans;
}
#include <bits/stdc++.h>

using ull = unsigned long long int;
using ll = long long;
using ld = long double;
using pii = std::pair<int,int>;
using pll = std::pair<ll, ll>;
using vi = std::vector<int> ;
using vvi = std::vector<vi> ;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double> ;
using vvd = std::vector<vd> ;
using qi = std::queue<int> ;
using vpii = std::vector<std::pair<int, int> >;
using vpll = std::vector<pll>;
using namespace std;

#define rep(i,j) for(int (i)=0;(i)<(j);(i)++)
#define drep(i,j) for(int (i)=(j);(i) >= 0;(i)--)


template<class T1, class T2> inline void chmin(T1 &a, T2 b){if(a > b) a = b;}
template<class T1, class T2> inline void chmax(T1 &a, T2 b){if(a < b) a = b;}
template<class T> inline void pri(T a){cout << a << endl;}
template<class Z> using vec = vector<Z>;
template<class T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
 cout << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
cout << first << " " ; 
OUT(rest...);
   return;
}
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;
const int INF = int(1e9);
const long long int INFL = (long long int)1e18;

int n,m,k;
string S;
int ans;

void solve()
{
  int N;
  IN(N);
  string S,X;
  IN(S,X);
  vi dp(N+1);
  dp[N] = 1;
  vi ten(N+5);
  ten[0] = 1;
  rep(i,N+1)
  {
    ten[i+1] = (ten[i]*10) %7;
  }
  //OUT("dp[N]",dp[N]);
  for(int i=N;i>0;i--)
  {
    vi pos;
    rep(j,7)
    {
      if(dp[i]&(1 << j))
      {
        pos.push_back(j);
        //OUT(j);
      }
    }
    //for(auto e : pos) cout << e << " ";
    //OUT();
    if(X[i-1] == 'T')
    {
      int x = S[i-1] - '0';
      //OUT("x",x);
      x *= ten[N-i];
      x %= 7;
      int ret = 0;
      for(auto &e: pos )
      {
        int k = (e - x + 7)%7;
        ret |= (1 << k);
        ret |= (1 << e);
      }
      //OUT("x",x);
      dp[i-1] = ret;
      //OUT("T",dp[i-1]);
    }
    else 
    {
      int x = S[i-1] - '0';
      //OUT("x",x);
      x *= ten[N-i];
      x %= 7;
      int tmp1 = 0;
      int tmp2 = 0;
      for(auto &e : pos)
      {
        int k = (e - x + 7)%7;
        tmp1 |= (1 << k);
        tmp2 |= (1 << e);
      }
      dp[i-1] = (tmp1 & tmp2);
      //OUT("x",x);
      //OUT("A",dp[i-1]);
    }
  }
  if(dp[0] & 1)
  {
    cout << "Takahashi" << endl;
  }
  else cout << "Aoki" << endl;
}

signed main (int argc, char* argv[]) 
{
   cin.tie(0);
   ios::sync_with_stdio(false);
   int cases=1;
   //IN(cases);
   while(cases--)solve();
   //pri(ans);
   //for(auto c : ans){cout << c << endl;}
   //cout << fixed << setprecision(15) << ans << endl;
   return 0;
}