#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int N;
string S, X;
vector<int> v;

int main() {
    cin >> N >> S >> X;
    v.resize(N);
    for (int i = N - 1, a = 1; i >= 0; i--, a = a * 10 % 7) {
        v[i] = a * (S[i] - '0') % 7;
    }
    vector<vector<bool>> dp(N + 1, vector<bool>(7));
    dp[N][0] = true;
    for (int i = N - 1; i >= 0; i--) {
        if (X[i] == 'T') {
            for (int j = 0; j < 7; j++) {
                dp[i][j] = dp[i+1][j] || dp[i+1][(j-v[i]+7) % 7];
            }
        } else {
            for (int j = 0; j < 7; j++) {
                dp[i][j] = dp[i+1][j] && dp[i+1][(j-v[i]+7) % 7];
            }
        }
    }
    cout << (dp[0][0] ? "Takahashi" : "Aoki") << endl;
}

#include<iostream>
#include<string>
#include<cmath>
using namespace std;

int main() {
	int r1, r2, c1, c2;
	int result = 0;

	cin >> r1 >> c1;
	cin >> r2 >> c2;

	if (r1 == r2 && c1 == c2) {
		result = 0;
	}
	else if (r1 + c1 == r2 + c2 || r1 - c1 == r2 - c2 || abs(r1 - r2) + abs(c1 - c2) <= 3) {
		result = 1;
	}
	else if((r1+c1)%2==(r2+c2)%2||abs(r1-r2+c1-c2)<=3||abs(r1-r2-c1+c2)<=3){
		result = 2;
	}
	else {
		result = 3;
	}


	cout << result;
	return 0;
}