#include <iostream>
#include <vector>
#include <string>
#include <array>
using namespace std;

string s, t;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int n; cin >> n >> s >> t;
	vector<array<int, 7>> dp(n + 1);
	for (int i = 0; i < 7; i++) dp[n][i] = (i != 0);
	for(int i = n - 1; i >= 0; i--)
		for (int j = 0; j < 7; j++) {
			if (t[i] == 'A') {
				if (dp[i + 1][(j * 10) % 7]) { dp[i][j] = 1; continue; }
				if (dp[i + 1][(j * 10 + s[i] - '0') % 7]) { dp[i][j] = 1; continue; }
				dp[i][j] = 0;
			}
			else {
				if (!dp[i + 1][(j * 10) % 7]) { dp[i][j] = 0; continue; }
				if (!dp[i + 1][(j * 10 + s[i] - '0') % 7]) { dp[i][j] = 0; continue; }
				dp[i][j] = 1;
			}
		}
	cout << (dp[0][0] ? "Aoki" : "Takahashi") << '\n';
	cin.ignore(2); return 0;
}
#include <bits/stdc++.h>
#ifdef LILY
#include "./Debug.h"
#else
#define var(...) (0)
#define dbg(...) (0)
#endif
using int32 = int;
using int64 = long long;
using namespace std;

class Solution
{
#define int int32
#define sfor(i, n) for (int i = 1; i <= (n); ++i)
#define tfor(i, n) for (int i = 0; i < (n); ++i)

    int n;
    string s, x;
    // dp[i] is a set including the numbers which Takahashi wants the remainder of the current number divided by 7 to be after the appending i digits.
    vector<int> dp;

    void SHURU()
    {
        cin >> n;
        cin >> s >> x;
        dp = vector<int>(n + 1, 0);
        dp[n] = 1;
    }

    void SHUCHU()
    {
        cout << ((dp[0] & 1) ? "Takahashi\n" : "Aoki\n");
    }

    int Tmove(int ap, int tars)
    {
        dbg(var(ap));
        int ret = 0, d, e;
        for (int i = 0; i < 10; ++i)
        {
            d = (3 * i + ap) % 7;
            e = (3 * i) % 7;
            if ((tars & (1 << d)) || (tars & (1 << e)))
            {
                ret |= (1 << i);
                dbg(var(d), var(tars));
            }
        }
        return ret;
    }

    int Amove(int ap, int tars)
    {
        dbg(var(ap));
        int ret = 0, d, e;
        for (int i = 0; i < 10; ++i)
        {
            d = (3 * i + ap) % 7;
            e = (3 * i) % 7;
            if ((tars & (1 << d)) && (tars & (1 << e)))
            {
                ret |= (1 << i);
                dbg(var(d), var(e), var(tars));
            }
        }
        return ret;
    }

    void CHULI()
    {
        for (int i = n - 1; i >= 0; i--)
        {
            switch (x[i])
            {
            case 'T':
                dp[i] = Tmove(s[i] - 48, dp[i + 1]);
                break;
            case 'A':
                dp[i] = Amove(s[i] - 48, dp[i + 1]);
                break;
            default: dbg("WTF, ", var(x[i]));
                break;
            }
            dbg(var(i), var(dp[i]));
        }
    }

public:
    Solution()
    {
        SHURU();
        CHULI();
        SHUCHU();
    }
#undef int
#undef tfor
#undef sfor
};

int32 main()
#ifndef LILY
{
    Solution();
}
#endif
