#include <bits/stdc++.h>
using namespace std;
 
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)
 
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <int,int> ii;
const int mod = 1e9 + 7;
const ll INF = 3e18;
const double EPSILON = 1e-9;
const int N = 2e5+5;
int dp[N][7]; // dp[i][j] : true if takahashi can get the remainder j on the i'th position
/* if x[i]=='T' takahashi needs only one chance to get the remainder to win, else takashi needs both chances to get the remainder
otherwise aoki will choose the other option to get a different remainder in order to takahashi loose
*/
int main(){
    fastio;
    int n, ten = 1;
    string s,x;
    cin >> n >> s >> x;
    dp[n][0] = 1;
    for(int i = n-1; i >= 0; i--){
        for(int j = 0; j < 7; j++){
            // append zero |& append s[i]
            if(x[i] == 'T'){
                dp[i][j] = dp[i+1][j] | dp[i+1][(j+(ten*(s[i]-'0')))%7];
            }else{
                dp[i][j] = dp[i+1][j] & dp[i+1][(j+(ten*(s[i]-'0')))%7];
            }
        }
        ten = (ten * 10) % 7;
    }
    cout << (dp[0][0]?"Takahashi":"Aoki") << "\n";
    return 0;
}
// DOES IT HAVE OVERFLOW ?
// DOES IT HAVE INVALID MEMO ACESS ?
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<random>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
typedef vector<vt>vvt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const long double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

int dp[200200][17][2];
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin>>n;
	int t=-1;
	rep(i,n){
		int a,b,c;
		cin>>a>>b>>c;
		if(c-a>=1){
			if(t==-1||t>=b)t=b;
		}
	}
	cout<<t<<endl;
}
