#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>
#include<stack>
#include<queue>
#include<map>
#include<deque>
#include<math.h>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,n) for(ll i=1;i<=n;i++)
#define ALLOF(c) (c).begin(), (c).end()
#define Pa pair<ll,ll>
const ll mod=1000000007;
const ll modq=998244353;
const ll INF=1e12;
const ll inf=-1;
ll ABS(ll a){return max(a,-a);}


   
int main(void){
    ll N;
    string S,X;
    cin>>N>>S>>X;
    reverse(ALLOF(S));
    reverse(ALLOF(X));
    vector<vector<bool>> TW(N+1,vector<bool>(7,false));

    TW.at(0).at(0)=true;
    ll ima=1;
    rep(i,N){
        ll num=S.at(i)-'0';
        if(X.at(i)=='A'){
            rep(j,7) TW.at(i+1).at((j+ima*num)%7)=(TW.at(i).at(j) && TW.at(i).at((j+ima*num)%7));
        }
        else{
            rep(j,7) TW.at(i+1).at((j+ima*num)%7)=(TW.at(i).at(j) || TW.at(i).at((j+ima*num)%7));
        }
        ima=(ima*10)%7;
    }
    if(TW.at(N).at(0)) cout<<"Takahashi"<<endl;
    else cout<<"Aoki"<<endl;
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')';}
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) {os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
template<typename T> void dbg_a(T *a,int l,int r){cerr<<" {";for(int i = l;i<r;i++) cerr<<a[i]<<", ";cerr<<a[r]<<"}"<<endl;}
typedef long long ll;
//#define int ll
inline int read(){
	int f(1),r(0);char c(getchar());
	while(c<'0'||c>'9'){if(c == '-') f = -1; c = getchar();}
	while(c>='0'&&c<='9'){ r = (r<<1) + (r<<3) + c - '0';c = getchar();}
	return f*r;
}
typedef pair<int,int> PII;
#define fi first
#define se second
#define mst(a,b) memset(a,b,sizeof(a))
#define For(i,a,b) for(int i = a;i<=b;i++)
#define For_(i,a,b) for(int i = a;i>=b;i--)
#define _for(i,a) for(int i = 0;i<a;i++)
#define _sum(a,l,r) accumulate(a + l,a + 1 + r,0)
#define All(x) x.begin(),x.end()
//    For(i,1,n) For(j,1,m) printf("f[%lld][%lld] = %lld\n",i,j,f[i][j]);
//const ll INF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 10,M = N*2 + 10;
const int mod = 998244353;
int h[N],ne[M],e[M],idx;
void add(int a,int b){
	e[++idx] = b,ne[idx] = h[a],h[a] = idx;
}
bool dp[N][10];
void solve(){
	int n = read();
	string s,x;
	cin>>s>>x;
	dp[n][0] = 1;
	For_(i,n-1,0){
		For(j,0,6){
			int q = dp[i+1][10*j%7],p = dp[i+1][(10*j + s[i] - '0')%7];
			if(x[i] == 'T') dp[i][j] = q|p;
			else dp[i][j] = q&p;
		}
	}
	if(dp[0][0]) cout<<"Takahashi\n";
	else cout<<"Aoki\n";
}	
signed main(){
	int T = 1;
	//T = read();
	while(T--) solve();
	system("pause");
	return 0;
}
