#include <bits/stdc++.h>

using namespace std;

typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef ptrdiff_t isize;

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef size_t usize;

typedef float f32;
typedef double f64;

#define unordered_set set

auto main() -> i32 {

    ios::sync_with_stdio(false), cin.tie(nullptr);

    i64 n;
    string s, x;
    cin >> n >> s >> x;
    unordered_set<i64> need;
    need.insert(0);
    for (i64 i = n - 1; i >= 0; i--) {
        if (x[i] == 'A') {
            unordered_set<i64> next;
            for (i64 d = 0; d < 7; d++) {
                i64 ned = (d * 3) % 7 + 0;
                if (need.find(ned) != need.end()) {
                    i64 ned = ((d * 3) % 7 + s[i] - '0') % 7;
                    if (need.find(ned) != need.end()) {
                        next.insert(d);
                    }
                }

            }
            need = next;
        }
        else {
            unordered_set<i64> next;
            for (auto d : need) {
                i64 nxt = (d - (s[i] - '0')) % 7;
                if (nxt < 0) nxt += 7;
                nxt = (nxt * 5) % 7;
                next.insert(nxt);


                nxt = (d - 0) % 7;
                if (nxt < 0) nxt += 7;
                nxt = (nxt * 5) % 7;
                next.insert(nxt);
            }
            need = next;
        }
    }
    if (need.find(0) != need.end()) {
        cout << "Takahashi";
    }
    else {
        cout << "Aoki";
    }
    cout << "\n";

    return 0;
}

// 問題の URL を書いておく
// 

#include <bits/stdc++.h>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

#define rep(i, n) for(int i = 0; i < (int)(n); ++i)

using ll = long long;

// 0 なら高橋勝ち
// 1 なら青木勝ち
int calc(int round, int m, string& S, string& T, vector<vector<int>>& state)
{
    Print(round);
    Print(m);
    if(state[round][m] != -1) return state[round][m];

    // 最終ラウンド
    auto n = S[round] - '0';
    if(round == (int)state.size() - 1)
    {
        if(T[round] == 'A')
        {
            if(m != 0 || (m + n) % 7  != 0)
            {
                state[round][m] = 1;
            }
            else state[round][m] = 0;
        }
        else
        {
            if(m == 0 || (m + n) % 7  == 0)
            {
                state[round][m] = 0;
            } 
            else state[round][m] = 1;
        }

        Print(state[round][m]);
        return state[round][m];
    }


    if(T[round] == 'A')
    {
        if(calc(round + 1, (m * 10) % 7, S, T, state) == 1 || calc(round + 1, (m + n) * 10 % 7, S, T, state) == 1)
        {
            state[round][m] = 1;
            return 1;
        }
        state[round][m] = 0;
        return 0;
    }
    else
    {
        if(calc(round + 1, (m * 10) % 7, S, T, state) == 0 || calc(round + 1, (m + n) * 10 % 7, S, T, state) == 0)
        {
            state[round][m] = 0;
            return 0;
        }
        state[round][m] = 1;
        return 1;
    }
}

int main(int, const char**)
{
    int N;
    cin >> N;
    string S, T;
    cin >> S >> T;

    vector<vector<int>> state(N, vector<int>(7, -1));

    auto ans = calc(0, 0, S, T, state);
    Print(ans);
    cout << (ans == 0 ? "Takahashi" : "Aoki") << endl;
    return 0;
}
