#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 <iostream>
#include <string> 
#include <vector> 
#include <algorithm>
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
using namespace std;

const int INF = 2000000000;
int N,M,Q;

int main() {
    // Step #1. Input
    cin >> N;
    vector<int> xa(N+1);
    vector<int> ya(N+1);
    for (int i = 1; i <= N; i++){
        cin >> xa[i] >> ya[i];
    }
    cin >> M;
    vector<vector<int64_t> > X(M+1,vector<int64_t>(4));
    vector<vector<int64_t> > Y(M+1,vector<int64_t>(4));
    /*
    for (int i = 1; i <= N; i++){
        X[0][i]=xa[i];
        Y[0][i]=ya[i];
    }
    */
   X[0][1]=0;
   Y[0][1]=0;
   X[0][2]=1;
   Y[0][2]=0;
   X[0][3]=0;
   Y[0][3]=1;

    for(int i=1;i<=M;i++){
        int a;
        int64_t b;
        cin >> a;
        if(a>2){
            cin >> b;
        }
        for(int j=1;j<=3;j++){
            int64_t x=X[i-1][j];
            int64_t y=Y[i-1][j];
            if(a==1){
                X[i][j]=y;
                Y[i][j]=0-x;
            }else if(a==2){
                X[i][j]=0-y;
                Y[i][j]=x;
            }else if(a==3){
                X[i][j]=2*b-x;
                Y[i][j]=y;
            }else{
                X[i][j]=x;
                Y[i][j]=2*b-y;
            }
        }
    }
    
    cin >> Q;
    for(int i=1;i<=Q;i++){
        int a,b;
        cin >> a >> b;
        int64_t x_x=X[a][2]-X[a][1];
        int64_t x_y=Y[a][2]-Y[a][1];
        int64_t y_x=X[a][3]-X[a][1];
        int64_t y_y=Y[a][3]-Y[a][1];
        cout << X[a][1]+x_x*xa[b]+y_x*ya[b] << " " << Y[a][1]+x_y*xa[b]+y_y*ya[b] << endl;
        
        //cout << X[a][b] << " " << Y[a][b] << endl;
    }
    /*
    for(int i=1;i<=3;i++){
        cout << X[M][i] << " " << Y[M][i] << endl;
    }
    */


    
    //cout << sum << endl;

}

