// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

bool dp[200010][10];
bool visited[200010][10];
int main() {
    int N; cin >> N;
    string S, X; cin >> S >> X;

    auto calc = [&](auto &&f, int idx, int mod) {
                    if(visited[idx][mod])
                        return dp[idx][mod];
                    visited[idx][mod] = true;
                    if(idx + 1 == N) {
                        int m1 = (mod * 10 + 0) % 7;
                        int m2 = (mod * 10 + (S[idx] - '0')) % 7;
                        if(X[idx] == 'T' and (m1 == 0 or m2 == 0))
                            return dp[idx][mod] = true;
                        if(X[idx] == 'A' and (m1 != 0 or m2 != 0))
                            return dp[idx][mod] = true;
                        return dp[idx][mod] = false;
                    }
                    else {
                        int m1 = (mod * 10 + 0) % 7;
                        int m2 = (mod * 10 + (S[idx] - '0')) % 7;
                        bool b1 = f(f, idx+1, m1);
                        bool b2 = f(f, idx+1, m2);
                        if(X[idx] == X[idx+1] and (b1 or b2)) {
                            return dp[idx][mod] = true;
                        }
                        else if(X[idx] != X[idx+1] and (!b1 or !b2)) {
                            return dp[idx][mod] = true;
                        }
                        return dp[idx][mod] = false;
                    }
                };
    bool a = calc(calc, 0, 0);
    if(X.front() == 'T') {
        cout << (a ? "Takahashi" : "Aoki") << endl;
    }
    else {
        cout << (a ? "Aoki" : "Takahashi") << endl;
    }
    return 0;
}

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

#ifdef LOCAL
#include "/debug.h"
#else
#define db(...)
#endif

#define all(v) v.begin(), v.end()
#define pb push_back
using ll = long long;
const int NAX = 2e5 + 5, MOD = 1000000007;

string solveCase(int64_t N, string S, string X)
{
    // TODO: edit here
    vector<int> win_t(7);
    win_t[0] = 1;
    reverse(all(S));
    reverse(all(X));
    int curr = 1;
    for (size_t i = 0; i < N; i++)
    {
        int val = ((S[i] - '0') * curr) % 7;
        vector<int> win_next_t(7);
        for (size_t j = 0; j < 7; j++)
        {
            if (X[i] == 'T')
            {
                int now = (j + val) % 7;
                if (win_t[now])
                    win_next_t[j] = 1;
                else
                    win_next_t[j] = win_t[j];
            }
            else
            {
                int now = (j + val) % 7;
                if (!win_t[now])
                    win_next_t[j] = 0;
                else
                    win_next_t[j] = win_t[j];
            }
        }
        curr = (curr * 10) % 7;
        win_t = win_next_t;
        db(i, win_t, curr, val);
    }
    if (win_t[0])
        return "Takahashi";
    return "Aoki";
}

// generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator)
int main()
{
#ifndef LOCAL
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif
    constexpr char endl = '\n';
    int N;
    string X, S;
    cin >> N >> S >> X;
    auto ans = solveCase(N, S, X);
    cout << ans << endl;
    return 0;
}