#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
using namespace std;
void solve(){
	int n;
	string s,t;
	cin>>n>>s>>t;
	vector <int> aw {0,1,1,1,1,1,1},tw {1,0,0,0,0,0,0};
	for (int i=n-1; i>=0; i--){
		vector <int> temp {0,0,0,0,0,0,0};
		if (t[i]=='A'){
			for (int j=0; j<7; j++){
				if (!aw[j]) continue;
				for (int k=0; k<7; k++){
					if ((10*k)%7==j||(10*k+s[i]-'0')%7==j) temp[k]=1;
				}
			}
			aw=temp;
			for (int j=0; j<7; j++) tw[j]=aw[j]^1;
		} else {
			for (int j=0; j<7; j++){
				if (!tw[j]) continue;
				for (int k=0; k<7; k++){
					if ((10*k)%7==j||(10*k+s[i]-'0')%7==j) temp[k]=1;
				}
			}
			tw=temp;
			for (int j=0; j<7; j++) aw[j]=tw[j]^1;
		}
	}
	if (aw[0]) cout<<"Aoki";
	else cout<<"Takahashi";
}
signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int t=1;
	//cin>>t;
	while (t--) solve();
}
#include <cstdio>
using namespace std;

const int max_n = 200000;
char s[max_n+1], op[max_n+1];
bool wn[7] = {}, nwn[7];

int main()
{
	int n, cur = 1;
	bool sl1, sl2;

	scanf("%d%s%s", &n, s, op);
	wn[0] = true;

	for (int i = n - 1; i >= 0; i--)
	{
		for (int j = 0; j < 7; j++)
			nwn[j] = wn[j];

		if (op[i] == 'A')
		{
			for (int j = 0; j < 7; j++)
				if (!wn[(j+cur*(s[i]-'0'))%7])
					nwn[j] = false;
		}
		else
		{
			for (int j = 0; j < 7; j++)
				if (wn[(j+cur*(s[i]-'0'))%7])
					nwn[j] = true;
		}

		sl1 = true, sl2 = false;
		for (int j = 0; j < 7; j++)
		{
			wn[j] = nwn[j];
			sl1 &= wn[j], sl2 |= wn[j];
		}

		if (sl1)
		{
			puts("Takahashi");
			return 0;
		}
		else if (!sl2)
		{
			puts("Aoki");
			return 0;
		}

		cur = (cur * 10) % 7;
	}

	if (wn[0])
		puts("Takahashi");
	else
		puts("Aoki");

	return 0;
}