/*
  Created by: Amit Kumar at 22:29 on 16 Mar 21
*/
#include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.h"
#else
#define db(...)
#endif
using namespace std;
#define ll long long
#define mod 1000000007
#define S(x, n) memset(x, n, sizeof(x));
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define NIL -1
const int MAXN = 1e5 + 1;

long long power(long long x, long long y, long long md)
{
    long long res = 1;
    x = x % md;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % md;
        y = y >> 1;
        x = (x * x) % md;
    }
    return res;
}

void solve()
{
    int n;
    cin >> n;
    string t;
    cin >> t;
    string s;
    cin >> s;

    // true for Takahasi
    vector<vector<bool>> dp(n + 1, vector<bool>(7, 0));
    dp[n][0] = true;
    for (int i = n - 1; i >= 0; i--)
    {
        if (s[i] == 'A')
        {
            for (int j = 0; j < 7; j++)
            {
                dp[i][j] = dp[i + 1][(j * 10) % 7] && dp[i + 1][((j * 10) + t[i] - '0') % 7];
            }
        }
        else
        {
            for (int j = 0; j < 7; j++)
            {
                dp[i][j] = dp[i + 1][(j * 10) % 7] || dp[i + 1][((j * 10) + t[i] - '0') % 7];
            }
        }
    }
    db(dp);
    if (dp[0][0])
        cout << "Takahashi\n";
    else
        cout << "Aoki\n";
}
int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    auto started = std::chrono::high_resolution_clock::now();
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    t = 1;
    //cin >> t;
    for (int I = 1; I <= t; I++)
    {
#ifdef LOCAL
        cerr << "TestCase " << I << "\n";
#endif
        solve();
    }
#ifdef LOCAL
    auto done = std::chrono::high_resolution_clock::now();
    cerr << "Time = " << std::chrono::duration_cast<std::chrono::milliseconds>(done - started).count() << " ms\n";
#endif
    return 0;
}
#include <cstdio>
using namespace std;

const int max_n = 200000;
char s[max_n+1], op[max_n+1];
bool wn[7] = {}, nwn[7];

int main()
{
	int n, cur = 1;
	bool sl1, sl2;

	scanf("%d%s%s", &n, s, op);
	wn[0] = true;

	for (int i = n - 1; i >= 0; i--)
	{
		for (int j = 0; j < 7; j++)
			nwn[j] = wn[j];

		if (op[i] == 'A')
		{
			for (int j = 0; j < 7; j++)
				if (!wn[(j+cur*(s[i]-'0'))%7])
					nwn[j] = false;
		}
		else
		{
			for (int j = 0; j < 7; j++)
				if (wn[(j+cur*(s[i]-'0'))%7])
					nwn[j] = true;
		}

		sl1 = true, sl2 = false;
		for (int j = 0; j < 7; j++)
		{
			wn[j] = nwn[j];
			sl1 &= wn[j], sl2 |= wn[j];
		}

		if (sl1)
		{
			puts("Takahashi");
			return 0;
		}
		else if (!sl2)
		{
			puts("Aoki");
			return 0;
		}

		cur = (cur * 10) % 7;
	}

	if (wn[0])
		puts("Takahashi");
	else
		puts("Aoki");

	return 0;
}