
#include <bits/stdc++.h>
using namespace std;

int n; 
int dp[200001][8] ; 
string s, x ; 

bool fun(int idx, int num) {
	if (idx > n) return (num == 0) ; 
	int &ret = dp[idx][num] ; 
	if (ret != -1) return ret ; 
	int cur = 0 ; 
	if (x[idx] == 'A') { 
		cur = fun(idx+1, (num * 10)%7) ; 
		if (cur == 1) cur = fun(idx+1, (num * 10 + (s[idx] - '0'))%7) ; 
	}
	else {
		cur = fun(idx+1, (num * 10)%7) ; 
		if (cur == 0) cur = fun(idx+1, (num * 10 + (s[idx] - '0'))%7) ; 
	}
	return ret = cur ; 
}

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

    cin >> n >> s >> x; 
    s = "#" + s ; 
    x = "#" + x ; 
    memset(dp, -1, sizeof(dp)) ; 
    bool ok = fun(1, 0) ; 
    string ans = "Aoki" ; 
    if (ok) ans = "Takahashi" ; 
    cout << ans << endl ; 
    return 0;
}


#ifdef LOGX
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;

/*---------macro---------*/
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = s; i < (int)(n); ++i)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define mybit(i,j) (((i)>>(j))&1)

/*---------type/const---------*/
typedef long long ll;
typedef unsigned long long ull;
typedef std::string::const_iterator state; //構文解析
const ll big=1000000007;
//const ll big=998244353;
const double EPS=1e-8; //適宜変える
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const char newl='\n';
struct{
    constexpr operator int(){return -int(1e9)-10;}
    constexpr operator ll(){return -ll(1e18)-10;}
}neginf;
struct{
    constexpr operator int(){return int(1e9)+10;}
    constexpr operator ll(){return ll(1e18)+10;}
    constexpr auto operator -(){return neginf;}
}inf;

/*---------debug---------*/
#ifdef LOGX
#include <template/debug.hpp>
#else
#define dbg(...) ;
#define dbgnewl ;
#define prt(x) ;
#define _prt(x) ;
#endif

/*---------function---------*/
template<typename T> T max(const std::vector<T> &a){T ans=a[0];for(T elem:a){ans=max(ans,elem);}return ans;}
template<typename T> T min(const std::vector<T> &a){T ans=a[0];for(T elem:a){ans=min(ans,elem);}return ans;}
template<typename T,typename U> bool chmin(T &a,const U b){if(a>b){a=b;return true;}return false;}
template<typename T,typename U> bool chmax(T &a,const U b){if(a<b){a=b;return true;}return false;}
bool valid(int i,int j,int h,int w){return (i>=0 && j>=0 && i<h && j<w);}
template<class T,class U>T expm(T x,U y,const ll mod=big){T res=1;while(y){if(y&1)(res*=x)%=mod;(x*=x)%=mod;y>>=1;}return res;}
template<class T,class U>T exp(T x,U y){T res=1;while(y){if(y&1)res*=x;x*=x;y>>=1;}return res;}



int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.precision(10);
    /*--------------------------------*/
    
    int n;cin >> n;
    string s;cin >> s;
    string x;cin >> x;
    //「高橋の勝ち」.
    vector<vector<bool>> dp(n+1,vector<bool>(7,false));
    dp[n][0]=true;
    for(int i=n-1;i>=0;i--){
        int now=expm(10,n-i-1,7);
        if(x[i] == 'T'){
            rep(j,7){
                if(dp[i+1][j] || dp[i+1][(j+now*(s[i]-'0')) %7]){
                    dp[i][j]=true;
                }
                else{
                    dp[i][j]=false;
                }
            }
        }
        else{
            rep(j,7){
                if((!dp[i+1][j])|| !dp[i+1][(j+now*(s[i]-'0')) %7]){
                    dp[i][j]=false;
                }
                else{
                    dp[i][j]=true;;
                }
            }
        }
    }
    cout << (dp[0][0] ? "Takahashi" : "Aoki") << newl;
}