#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define eps (double)(1e-9)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;



int main(){
    int n;
    string s, x;
    cin >> n >> s >> x;
    vector<vector<bool>> dp(n+1, vector<bool>(7));
    dp[n][0] = true;
    REP(i, 6)dp[n][i] = false;
    for(int i = n-1; i >= 0; i--){
        int now = s[i] - '0';
        if(x[i] == 'T'){
            rep(j, 7){
                dp[i][j] = false;
                if(dp[i+1][(10*j)%7])dp[i][j] = true;
                if(dp[i+1][(10*j+now)%7])dp[i][j] = true;
            }
        }else{
            rep(j, 7){
                dp[i][j] = false;
                if(dp[i+1][(10*j)%7] && dp[i+1][(10*j+now)%7])dp[i][j] = true;
            }
        }
    }
    cout << (dp[0][0] ? "Takahashi" : "Aoki") << endl;
}
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
#include<bits/stdc++.h>
#include<unordered_set>
#define INF 0x3f3f3f3f
#define mod 1000000007
#define G 3
#define MAX_N 300005
using namespace std;
typedef long long ll;
typedef pair<ll,ll>P;
int n,dp[200005][10];
char s[200005],t[200005];
int dfs(int i,int x){
	//cout<<i<<' '<<x<<endl;
	if(dp[i][x]!=-1)return dp[i][x];
	if(i==n){
		if(x==0)return 0;
		else return 1;
	}
	int ans;
	if(t[i]=='A'){
		if(dfs(i+1,(x*10)%7)||dfs(i+1,(x*10+s[i]-'0')%7))ans=1;
		else ans=0;
	}
	else{
		if(!dfs(i+1,(x*10)%7)||!dfs(i+1,(x*10+s[i]-'0')%7))ans=0;
		else ans=1;
	}
	return dp[i][x]=ans;
}
int main(){
	memset(dp,-1,sizeof(dp));
	cin>>n;
	scanf("%s%s",s,t);
	int ans=dfs(0,0);
	if(ans)puts("Aoki");
	else puts("Takahashi");
    return 0;
}