#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
#include <cassert>
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i)=0; (i) <= (n); (i)++)
#define CONTAINS_MAP(m, a) ((m).find((a)) != m.end())
#define CONTAINS_SET(m, a) ((m).find((a)) != m.end())
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; exit(0); }
void Yes() { cout << "Yes" << endl; exit(0); }
void No() { cout << "No" << endl; exit(0); }


int N;
int S[200001];
char X[200001];

int memo[200010][10];

bool func(int depth, int a)
{
	if (depth == N)
	{
		return a % 7 == 0;
	}

	if (memo[depth][a] >= 1)
	{
		return memo[depth][a] == 1;
	}


	int a1 = a * 10;
	int a2 = a * 10 + S[depth];

	a1 %= 7;
	a2 %= 7;

	bool f1 = func(depth + 1, a1);
	bool f2 = func(depth + 1, a2);

	bool ans;
	if (X[depth] == 'T')
	{
		ans = f1 || f2;
	}
	else
	{
		ans = f1 && f2;
	}
	memo[depth][a] = ans ? 1 : 2;
	return ans;
}

signed main()
{
	cin >> N;
	string s;
	cin >> s;
	REP(i, N)
	{
		S[i] = s[i] - '0';
	}
	cin >> X;

	bool f = func(0, 0);
	cout << (f ? "Takahashi" : "Aoki") << endl;
}



#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)

using namespace std;
using LL = long long;
using P = pair<int,int>;
using vv = vector<vector<int>>;
const int INF = (int)1e9;
const LL LINF = (LL)1e18;

int main(){
	int N;
	string S, X;
	cin >> N >> S >> X;
	reverse(S.begin(), S.end());
	reverse(X.begin(), X.end());
	vv dp(N + 1);
	dp[0].emplace_back(0);
	rep(i,N){
		rep(j,7){
			int n = S[i] - '0';
			int k1 = (j * 10 + n) % 7, k2 = j * 10 % 7;
			auto itr1 = find(dp[i].begin(), dp[i].end(), k1);
			auto itr2 = find(dp[i].begin(), dp[i].end(), k2);
			if(X[i] == 'A'){
				if(itr1 != dp[i].end() and itr2 != dp[i].end()){
					dp[i+1].emplace_back(j);
				}
			}
			else{
				if(itr1 != dp[i].end() or itr2 != dp[i].end()){
					dp[i+1].emplace_back(j);
				}
			}
		}
	}
	rep(i,dp[N].size()){
		if(dp[N][i] == 0){
			cout << "Takahashi" << endl;
			return 0;
		}
	}
	cout << "Aoki" << endl;

	return 0;
}
