#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int calcPow(int x, int y) {
    int z = 1;
    while (y > 0) {
        if (y & 1) {
            z = (z * x) % 7;;
        }
        x = (x * x) % 7;
        y /= 2;
    }
    return z;
}

int memo(const string& S, const string& X, vector<vector<int>>& dp, int idx, int mod, int pow) {
    if (idx == S.size()) {
        return mod == 0;
    }
    if (dp[idx][mod] >= 0) {
        return dp[idx][mod];
    }
    int nxt_pow = (pow * calcPow(10, 5)) % 7;
    if (X[idx] == 'A') {
        return dp[idx][mod] = memo(S, X, dp, idx + 1, (mod + (S[idx] - '0') * pow) % 7, nxt_pow) & memo(S, X, dp, idx + 1, mod, nxt_pow);
    } else {
        return dp[idx][mod] = memo(S, X, dp, idx + 1, (mod + (S[idx] - '0') * pow) % 7, nxt_pow) | memo(S, X, dp, idx + 1, mod, nxt_pow);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    string S, X;
    cin >> N >> S >> X;
    int pow = 1;
    rep(i, 0, N - 1) {
        pow = (pow * 10) % 7;
    }
    vector<vector<int>> dp(N, vector<int>(7, -1));
    if (memo(S, X, dp, 0, 0, pow)) {
        cout << "Takahashi" << endl;
    } else {
        cout << "Aoki" << endl;
    }
    return 0;
}
//I still luve you Kashish <3
#include<bits/stdc++.h>
using namespace std ;
#define int                 long long
#define pb                  push_back
#define F                   first
#define S                   second
#define P                   push
#define nl                  "\n"
#define vvi                 vector<vector<int>>
#define vi                  vector<int>
#define vc                  vector<char>
#define pii                 vector<pair<int, int>>
#define sz(a)               (int)a.size()
#define all(a)              a.begin(),a.end()
#define sort(v)             sort(all(v))
#define sortr(v)            sort(v); reverse(all(v));
#define yes                 cout << "YES"
#define no                  cout << "NO" 
#define PeeleMera           ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
int binpow(int a, int b)    { int res = 1; while (b > 0) { if (b & 1) res = res * a; a = a * a; b >>= 1; } return res;}
const int N = 1e9 + 7 , N1 = 1e7 + 5 , N2 = 1e6 + 3, N3 = 1e5 + 3;
#define IM -1e18
#define IX 1e18

// int binpowmod(int n,int p,int c)
// {
//     if (p==0)
//     {
//         return 1%c;
//     }
//     int m=binpowmod(n,p/2,c);
//     m*=m;
//     m%=c;
//     if (p%2)
//     {
//         m*=n%c;
//         m%=c;
//     }
//     return m;
// }

int binpowmod(int a, int b, int mod)     
{ 
    int res = 1; 
    while (b > 0) 
    { 
        if (b & 1) res = res * a , res = res % mod ; 
        a = a * a , a = a % mod ; 
        b >>= 1 ; 
    }
    return res % mod;
}

void solve()
{
    int a,b,c;
    cin>>a>>b>>c;
    a=a%10;
    vi va;
    set<int> ss;
 
    for(int i=1;i<=4;i++)
    {
        int x=binpow(a,i);
        if(ss.count(x%10)==1)
        break;
        
        va.pb(x%10);
        ss.insert(x%10);
    }
    int mod=sz(va);
    int x=binpowmod(b,c,mod);
    if(x==0) x=sz(va);
    cout<<binpow(a,x)%10;
}

signed main(){
    PeeleMera;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    // cin>>t;
    // cout<<fixed<<setprecision(9);
    while(t--)
    {
        solve();        
        cout<<endl;
    }
}