#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
using pll = pair<int, int>;

int n;
string nums, turn;
vector<vector<int>> dp;

void dfs(int i, int num) {
	if (i == n) {
		if (num % 7 == 0) dp[i][num] = true;
		else dp[i][num] = false;
		return;
	}
	int v1 = (num * 10) % 7;
	int v2 = (num * 10 + (nums[i] - '0')) % 7;
	if (dp[i + 1][v1] == -1) dfs(i + 1, v1);
	if (dp[i + 1][v2] == -1) dfs(i + 1, v2);
	if (turn[i] == 'A') {
		if (dp[i + 1][v1] && dp[i + 1][v2]) dp[i][num] = true;
		else dp[i][num] = false;
	}
	else {
		if (dp[i + 1][v1] || dp[i + 1][v2]) dp[i][num] = true;
		else dp[i][num] = false;
	}
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> n;
	cin >> nums;
	cin >> turn;

	dp.resize(n + 1, vector<int>(8, -1));

	dfs(0, 0);

	if (dp[0][0]) cout << "Takahashi" << endl;
	else cout << "Aoki" << endl;

	return 0;
}
                        //    I solemnly swear that I am upto no good //

#include <bits/stdc++.h>
#define sub   freopen("input.txt", "r", stdin);//freopen("output.txt", "w", stdout);
using namespace std;
#define ll long long
#define ld long double
#define ttime cerr << '\n'<<"Time (in s): " << double(clock() - clk) * 1.0 / CLOCKS_PER_SEC << '\n';
#define pb push_back
#define endl "\n"
#define unq(a) sort(all(a));a.resize(unique(all(a)) - a.begin())
#define sz(x) (int)((x).size())
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define fast ios_base::sync_with_stdio(false);cin.tie(0);
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define mp make_pair
#define ff first
#define ss second
#define YY cout<<"Yes"<<endl
#define NN cout<<"No"<<endl
#define ub upper_bound
#define lb lower_bound
#define A 1000001
const long long INF=1e18;
const long long mod=1000000007;
typedef pair<ll,ll> pairll;
typedef map<ll,ll> mapll;
bool comp(ll a,ll b){
    return a>b;
}
ll n,k;
void solve(){
    string s,t;
    cin>>n>>s>>t;

    std::vector<std::vector<bool> > dp(n+1, std::vector<bool> (7,0));
    dp[n][0]=1;

    for(int i=n-1;i>=0;--i){
        for(int r=0;r<7;++r){
            if(t[i]=='A'){
                dp[i][r]=true;
                for(int d : {0,s[i]-'0'}){
                    int rem=(r*10 + d)%7;
                    if(!dp[i+1][rem])dp[i][r]=0;
                }
            }
            else{
                dp[i][r]=false;
                for(int d : {0,s[i]-'0'}){
                    int rem=(r*10 + d)%7;
                    if(dp[i+1][rem])dp[i][r]=1;
                }   
            }
        }
    }
    cout << (dp[0][0] ? "Takahashi" : "Aoki") << "\n";

}

int main(){ 
    //sub;    
    fast;
    // pre();
    // clock_t clk = clock();
    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    // ttime;
    return 0;
}        

                                // Mischief Managed //            