#include<bits/stdc++.h>
#define print(x) cout << (#x) << ": " << (x) << endl
#define p1d(x) cout << (#x) << ": ["; for(auto& zz: x) cout << zz << " "; cout << "]\n"
#define p2d(x) cout << (#x) << ": \n["; for(auto& vec: x) {for(auto& v: vec) cout << v << " "; cout << ",\n";}
#define p2s(x) cout << (#x) << ": ["; for(auto& vec: x) {cout << vec << ",\n";}
#define pb push_back
#define endl "\n"
// __builtin_popcount

typedef long long ll;
using namespace std;
int static fast = [](){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);
int main() {
    int n;
    string s, x;
    cin >> n >> s >> x;
    vector<vector<int>> dp(n+1, vector<int>(7, -1));
    auto dfs = [&] (auto& self, int d, int rem) -> int {
        if (dp[d][rem] != -1) return dp[d][rem];
        int nxt[2] = {(rem * 10 + (s[d]-'0')) % 7, (rem * 10) % 7};
        if (d == n-1) {
            if (x[d] == 'T') {
                if (nxt[0] == 0 || nxt[1] == 0) return 1;
                return 0;
            } else {
                if (nxt[0] != 0 || nxt[1] != 0) return 1;
                return 0;
            }
        }
        int res = 0;
        if (x[d] == x[d+1]) {
            if (x[d] == 'T') {
                if (self(self, d+1, nxt[0]) == 1 || self(self, d+1, nxt[1]) == 1)
                    res = 1;
            } else {
                if (self(self, d+1, nxt[0]) == 1 || self(self, d+1, nxt[1]) == 1)
                    res = 1;
            }
        } else {
            if (x[d] == 'T') {
                if (self(self, d+1, nxt[0]) == 0 || self(self, d+1, nxt[1]) == 0)
                    res = 1;
            } else {
                if (self(self, d+1, nxt[0]) == 0 || self(self, d+1, nxt[1]) == 0)
                    res = 1;
            }
        }
        dp[d][rem] = res;
        return res;
    };
    if (dfs(dfs, 0, 0) == 1) {
        cout << ((x[0] == 'T') ? "Takahashi" : "Aoki") << endl;
    } else {
        cout << ((x[0] == 'A') ? "Takahashi" : "Aoki") << endl;
    }
   
    return 0;
}

//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll
//take care of precedence rule of operators 
//do not forget to change the sizes of arrays and value of contants and other things after debugging  
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define ld long double
#define pi acos(-1.0)
 
#define SZ(x)  (ll)(x.size())
 
//comment the below if not required
 
/*
 
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second
*/
 
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
 
//cout<<"Case #"<<c<<": "<<ans<<"\n" ;

const ll N = 2e5+2;

char a[N],b[N];

ll n,i,j,dp[N][7],val,temp1,temp2;

int main()
{

	IOS;

	cin>>n;

	for(i=1;i<=n;++i)
			cin>>a[i];

	for(i=1;i<=n;++i)
			cin>>b[i];

	dp[n+1][0]=1;

	for(i=n;i>=1;--i)
	{
		val = a[i]-'0';

		for(j=0;j<7;++j)
		{
			temp1 = (j*10+val)%7;
			temp2 = (j*10)%7;
			
			if(b[i]=='T')
			{
				if(dp[i+1][temp1] || dp[i+1][temp2])
					dp[i][j]=1;
			}
			else
			{
				if(dp[i+1][temp1] && dp[i+1][temp2])
					dp[i][j]=1;
			}

		}

	}

	if(dp[1][0]==1)
		cout<<"Takahashi\n";
	else
		cout<<"Aoki\n";


	return 0;
}