#include<bits/stdc++.h>
using namespace std;
int n,f[100001][10];
string s,x;
int main(){
	cin>>n;
	cin>>s>>x;
	f[n][0]=1;
	for(int i=n;i>=1;i--){
		for(int j=0;j<7;j++){
			bool a=f[i][(j*10)%7];
			bool b=f[i][(j*10+(s[i-1]-'0'))%7];
			if(x[i-1]=='T'){
				f[i-1][j]=a|b;
			}
			else{
				f[i-1][j]=a&b;
			}
		}
	}
	if(f[0][0]){
		cout<<"Takahashi";
	}
	else{
		cout<<"Aoki";
	}
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main(){
  char S,T;
  cin >> S;
  cin >> T;
  
  if(S=='Y'){
    if(T=='a') cout << "A" << endl;
    if(T=='b') cout << "B" << endl;
    if(T=='c') cout << "C" << endl;
  }else{
    cout << T << endl;
  }
}