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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    if(a == 0) return 0;
    b %= (M - 1);  //M must be prime here
    
    int res = 1;
    
    while(b > 0)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


void solve()
{
   int n;
    cin >> n;
    
   string s,t;
    cin >> s >> t;
    
   int states[n+1][7];
    
   f(i,n+1) f(j,7) states[i][j] = 0;
    
   states[n][0] = 1;
   
   int pw = 1; 
    
   for(int i=n-1;i>=0;i--)
   {
       int one = (pw*(s[i] - '0'))%7;
       int two = 0;
       
       f(j,7)
       {
           if(t[i] == 'T')
           {
               if(states[i+1][(j + one)%7] || states[i+1][(j + two)%7])
                   states[i][j] = 1;
           }
           else
           {
               if(states[i+1][(j + one)%7] && states[i+1][(j + two)%7])
                   states[i][j] = 1;
           }
       }
       
       pw = (pw*10)%7;
   }
    
   if(states[0][0]) cout <<"Takahashi\n";
    else cout <<"Aoki";
    
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define MOD(a, m) ((a % m + m) % m)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

int main(){
    ll M, H;
    cin >> M >> H;
    if(H % M == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}
