#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define PRINT(a) printf("%.15Lf\n",a);
#define YESNO(a) cout << (a ? "YES" : "NO") << endl
#define YesNo(a) cout << (a ? "Yes" : "No") << endl
#define yesno(a) cout << (a ? "yes" : "no") << endl
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;

int dp[200010][7];
int ten[200010];
int N;
string S, X;

int solve(int now, int m) {
	//cout << now << " " << m << endl;
	if (dp[now][m] != 0)return dp[now][m];
	if (now == N) {
		if (m == 0)return 1;
		else return 2;
	}
	else {
		int ans1 = solve(now + 1, m);
		int ans2 = solve(now + 1, (m + (S[now] - '0')*ten[N - now - 1]) % 7);
		//cout << now << " " << m << " " << ans1 << " " << ans2  <<" "<< S[now]<< endl;
		if (ans1 == 1 && ans2 == 1) {
			dp[now][m] = 1;
			return 1;
		}
		else if (ans1 == 2 && ans2 == 2) {
			dp[now][m] = 2;
			return 2;
		}
		else if (X[now] == 'T'){
			dp[now][m] = 1;
			return 1;
		}
		else{
			dp[now][m] = 2;
			return 2;
		}
	}
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N;
	REP(i, N) {
		if (i == 0)ten[i] = 1;
		else {
			ten[i] = (ten[i - 1] * 10) % 7;
		}
	}
	cin >> S >> X;
	int ans = solve(0, 0);
	if (ans == 1) {
		cout << "Takahashi" << endl;
	}
	else {
		cout << "Aoki" << endl;
	}
	


	return 0;
}


#include <bits/stdc++.h>

#define f first
#define s second

using namespace std;

typedef long long ll;

const int maxk = 10 + 1;
const int maxn = 2e5 + 17;

int N;
string S, X;

int DP[maxk][maxn];

bool solve(int i, int rem) {
    int &ret = DP[rem][i];
    if (ret != -1) return ret;

    if (i == N) return ret = !rem;

    int x = solve(i + 1, 10 * rem % 7);
    int y = solve(i + 1, (10 * rem + S[i] - '0') % 7);
    if (X[i] == 'A') return ret = min(x, y);
    return ret = max(x, y);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    memset(DP, 0xFF, sizeof DP);

    cin >> N >> S >> X;
    cout << (solve(0, 0) ? "Takahashi" : "Aoki") << endl;
    return 0;
}