#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int N;
    cin >> N;
    string S, X;
    cin >> S >> X;
    vector<int> pow_10(N);
    int tmp = 1;
    for (int i=N-1;i>=0;i--) {
        pow_10[i] = tmp;
        tmp = tmp*10%7;
    }

    // 0: takahashi
    // 1: aoki
    vector<int> vec(7, 1);
    vec[0] = 0;
    for (int i=N-1;i>=0;i--) {
        int num = S[i]-'0';
        vector<int> vec_next(7, -1);
        if (X[i] == 'T') {
            for (int j=0;j<7;j++) {
                if (vec[j] == 0) {
                    vec_next[j] = 0;
                    vec_next[(j-num*pow_10[i]%7+7)%7] = 0;
                }
            }
            for (int j=0;j<7;j++) {
                if (vec_next[j] == -1) vec_next[j] = 1;
            }
        } else { // X[i] == 'A
            for (int j=0;j<7;j++) {
                if (vec[j] == 1) {
                    vec_next[j] = 1;
                    vec_next[(j-num*pow_10[i]%7+7)%7] = 1;
                }
            }
            for (int j=0;j<7;j++) {
                if (vec_next[j] == -1) vec_next[j] = 0;
            }

        }
        vec = vec_next;
    }
    if (vec[0] == 0) cout << "Takahashi" << "\n";
    else cout << "Aoki" << "\n";

    return 0;
}

//#pragma GCC optimize(2)
#include<bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr)
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define lc(x) ((x)<<1)
#define rc(x) (((x)<<1)|1)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
 
const ll LINF=1e18;
const ll MOD=1e9+7;
const int INF=0x3f3f3f3f;
const int MAXM=500050;
const int MAXN=200050;

int dp[MAXN][7],n;
char s[MAXN],t[MAXN];
int dfs(int dep,int rem){
	if(dep>n){
		if(rem)return dp[dep][rem]=2;
		else return dp[dep][rem]=1;
	}
	
	if(dp[dep][rem])return dp[dep][rem];
	
	int now=s[dep]-'0';
	
	int idx1=(rem*10+now)%7,idx2=(rem*10)%7;
	
	dfs(dep+1,idx1);dfs(dep+1,idx2);
	
	if(t[dep]=='T'){
		if(dp[dep+1][idx1]==1||dp[dep+1][idx2]==1){
			return dp[dep][rem]=1;
		}else return dp[dep][rem]=2;
	}else if(t[dep]=='A'){
		if(dp[dep+1][idx1]==1&&dp[dep+1][idx2]==1){
			return dp[dep][rem]=1;
		}else return dp[dep][rem]=2;
	}
}
void mainwork(int T){
	scanf("%d",&n);
	scanf("%s",s+1);
	//reverse(s+1,s+n+1);
	scanf("%s",t+1);
	//reverse(t+1,t+n+1);
	dfs(1,0);
	if(dp[1][0]==1)puts("Takahashi");
	else puts("Aoki");
}
signed main(){
	//IOS;
	#ifndef ONLINE_JUDGE
	//freopen("./in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	#endif
	int t=1;
	//scanf("%d",&t);
	//prework();
	for(int i=1;i<=t;i++){
		mainwork(i);
	}
}