#include <bits/stdc++.h>

#define forsn(i,s,n) for(tint i=(s);i<(tint)(n); i++)
#define forn(i,n) forsn(i,0,n)
#define dforn(i,n) for(tint i = tint(n)-1; i >= 0; i--)
#define debug(x) cout << #x << " = "  << x << endl

using namespace std;

typedef long long tint;

random_device rd;
mt19937 gen(rd());

uniform_int_distribution<tint> dis(1, 10000);

void imprimirVector (vector<tint> v)
{
	if (!v.empty())
	{ 
		tint p = tint(v.size());
		cout << "[";
		forn(i,p-1)
			cout << v[i] << ",";
		cout << v[p-1] << "]" << endl;
	}
	else
		cout << "[]" << endl;
}

const tint MAXR = 7;

tint mod(tint a, tint b)
{
	a %= b;
	if (a < 0)
		a += b;
	return a;
}

tint mult_table[10][10];

int main()
{
	#ifdef ACMTUYO
		assert(freopen("entrada.in", "r", stdin));
	#endif
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	tint n;
	string s, x;
	forn(k1,10)
	forn(k2,10)
		mult_table[k1][k2] = mod(k1*10 + k2, MAXR);
	while (cin >> n >> s >> x)
	{
		vector<vector<tint> > win (n+1, vector<tint> (MAXR,0));
		forn(k,MAXR)
			win[n][k] = 0;
		win[n][0] = 1;
		
		for (tint i = n-1; i >= 0; i--)
		{
			if (x[i] == 'A')
			{
				forn(k,MAXR)
				{
					tint move1 = win[i+1][mult_table[k][0]];
					tint move2 = win[i+1][mult_table[k][s[i]-'0']];
					win[i][k] = tint((move1 + move2 ) == 2); 
				}
			}
			else
			{
				forn(k,MAXR)
				{
					tint move1 = win[i+1][mult_table[k][0]];
					tint move2 = win[i+1][mult_table[k][s[i]-'0']];
					win[i][k] = tint((move1 + move2) > 0); 
				}
			}
		}
		
		if (win[0][0] > 0)
			cout << "Takahashi\n";
		else
			cout << "Aoki\n";
			
	}
	
	
	return 0;
}





#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  string s; cin >> s;
  string x; cin >> x;
  set<int> st;
  rep(i, 10) if(i) st.insert(i);
  reverse(all(s));
  reverse(all(x));
  rep(i, n) {
    if(x[i] == 'T') {
      set<int> nextSt;
      rep(j, 10) nextSt.insert(j);
      rep(j, 10) {
        if(!st.count((j*10+(s[i]-'0'))%7)) nextSt.erase(j);
        if(!st.count((j*10)%7)) nextSt.erase(j);
      }
      st = nextSt;
    } else {
      set<int> nextSt;
      rep(j, 10) {
        if(st.count((j*10+(s[i]-'0'))%7)) nextSt.insert(j);
        if(st.count((j*10)%7)) nextSt.insert(j);
      }
      st = nextSt;
    }
  }
  cout << (st.count(0) ? "Aoki" : "Takahashi") << endk;
  return 0;
}
