
//================code===================//

//#define TLE

#ifdef TLE
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#endif

#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <ctime>

#define ci(t) cin>>t
#define co(t) cout<<t
#define LL long long
#define ld long double
#define fa(i,a,b) for(LL i=(a);i<(LL)(b);++i)
#define fd(i,a,b) for(LL i=(a);i>(LL)(b);--i)
#define setp pair<pair<int,int>,int>
#define setl pair<int,int>
#define micro 0.000001

using namespace std;

LL gcd(LL a, LL b) { return a % b ? gcd(b, a % b) : b; }
LL lcm(LL a, LL b) { return (a * b) / gcd(a, b); }
#ifdef OHSOLUTION
#define ce(t) cerr<<t
#define AT cerr << "\n=================ANS=================\n"
#define AE cerr << "\n=====================================\n"
#else
#define AT
#define AE
#define ce(t)
#define __popcnt __builtin_popcountll
#endif

pair <int, int> vu[9] = { {0,1},{1,0},{-1,0} ,{0,-1},{1,0},{1,0}, {-1,1} , {1,-1},{-1,-1} }; //RDLU EWSN

template<typename T, typename U> void ckmax(T& a, U b) { a = a < b ? b : a; }
template<typename T, typename U> void ckmin(T& a, U b) { a = a > b ? b : a; }
struct gcmp { bool operator()(LL a, LL b) { return a < b; } bool operator()(setl a, setl b) { return a.second < b.second; } };
struct lcmp { bool operator()(LL a, LL b) { return a > b; } bool operator()(setl a, setl b) { return a.second > b.second; } };

const int max_v = 2e5 + 7;
const int INF = 1e9 + 7;
const LL LNF = (LL)5e18 + 7ll;
const LL mod = 1e9 + 7;

string s;
string t;
int n;
int arr[max_v];
int ten[max_v];
int dp[max_v][7];

bool dnq(int idx, int m)
{
	if (idx == -1) return m==0;

	int& ret = dp[idx][m];

	if (~ret) return ret;

	if (t[idx] == 'A')
	{
		ret = 1;
		ret &= dnq(idx - 1, (ten[idx] * arr[idx]+m) % 7);
		ret &= dnq(idx - 1, m);
	}
	else
	{
		ret = 0;
		ret |= dnq(idx - 1, (ten[idx] * arr[idx] + m) % 7);
		ret |= dnq(idx - 1, m);
	}

	return ret;
}

int main()
{
#ifdef OHSOLUTION
	freopen("input.txt", "r", stdin);
#endif	
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);	
	ci(n >> s >> t);
	reverse(s.begin(), s.end());
	reverse(t.begin(), t.end());
	fa(i, 0, s.size()) arr[i] = s[i] - '0';

	ten[0] = 1;
	fa(i, 1, n) ten[i] = ten[i - 1] * 10 % 7;
	memset(dp, -1, sizeof(dp));
	bool ck = dnq(n - 1,0);
	ck ? co("Takahashi") : co("Aoki");
	return 0;
}

#include<ctime>
#include<cstdio>
#include<cctype>
#define ll long long
using namespace std;
const ll N=2e5+10;
const char s[]="110";
ll read() {
	char c;
	ll x=0,f=1;
	while(!isdigit(c=getchar()))
		f-=2*(c=='-');
	while (isdigit(c)){
		x=x*10+(c-48)*f;
		c=getchar();
	}
	return x;
}
ll n;
char str[N];
ll solve(){
	ll res=1e10;
	if(n==1){
		if(str[0]=='1')
			return res*2;
		return res;
	}
	if(n==2){
		if(str[0]=='1')
			return res;
		if(str[1]=='1')
			return res-1;
		return 0;
	}
	if(str[0]=='0'){
		--res;
		ll t=-1;
		for(ll i=1;i<n;++i){
			++t;
			if(t==3){
				--res;
				t=0;
			}
			if(str[i]^s[t])
				return 0;
		}
		return res;
	}
	if(str[1]=='0'){
		--res;
		ll t=-1;
		for(ll i=2;i<n;++i){
			++t;
			if(t==3){
				--res;
				t=0;
			}
			if(str[i]^s[t])
				return 0;
		}
		return res;
	}
	ll t=-1;
	for(ll i=0;i<n;++i){
		++t;
		if(t==3){
			--res;
			t=0;
		}
		if(str[i]^s[t])
			return 0;
	}
	return res;
}
int main() {
	#ifndef ONLINE_JUDGE
	freopen("B.in","r",stdin);
	freopen("B.out","w",stdout);
	#endif
	clock_t t1=clock();
	//--------
	n=read();
	scanf("%s",str);
	printf("%lld",solve());
	//--------
	clock_t t2=clock();
	fprintf(stderr,"time:%0.3lfs",1.0*(t2-t1)/CLOCKS_PER_SEC);
	return 0;
}