#include <bits/stdc++.h>
#define int int64_t

using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    string s,x;
    cin>>s>>x;
    int curr=1;
    set<int> nope;
    nope.insert(0);
    for (int i=n;i>=1;i--)
    {
        if (i!=n)
        {
            curr=(curr*10)%7;
        }
        int dig=s[i-1]-'0';
        dig=(dig*curr)%7;
        if (x[i-1]=='T')
        {
            set<int> cnt;
            for (auto el:nope)
            {
                cnt.insert(el);
                if (el<dig)
                    el+=7;
                el=el-dig;
                cnt.insert(el);
            }
            nope.clear();
            nope=cnt;
        }
        else
        {
            set<int> cnt;
            for (int i=0;i<=6;i++)
            {
                int nx=i+dig;
                nx=nx%7;
                if (nope.find(i)!=nope.end()&&nope.find(nx)!=nope.end())
                    cnt.insert(i);
            }
            nope.clear();
            nope=cnt;
        }
    }
    if (nope.find(0)!=nope.end())
        cout<<"Takahashi";
    else cout<<"Aoki";
    return 0;
}
#pragma GCC optimize("Ofast")
//#ifndef ONLINE_JUDGE 
//#define _GLIBCXX_DEBUG
//#endif
#ifdef ONLINE_JUDGE 
#include <atcoder/all>
#endif
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#include <math.h>
#include <complex>
 
 
using namespace std;
#ifdef ONLINE_JUDGE 
using namespace atcoder;
#endif
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = int;
#ifdef ONLINE_JUDGE 
//using mint = modint998244353;
//using mint = modint;
using mint = modint1000000007;
#endif
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1 << 25;
const double pi=acos(-1.0);
int dx[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int dy[9] = {0, 1, 0, -1, 1, -1, -1, 1, 0};
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
int uf[1<<18];

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);
 
  ll N,M; cin>>N>>M;
  vector<ll> graph(N,0);
  rep(_,M) {
    int a,b; cin>>a>>b; a--; b--;
    graph[a]|=1<<b;
    graph[b]|=1<<a;
  }
  
  vector<ll> dp(1<<N,INF);
  dp[0]=1;
  rep(i,N) rep(S,1<<N) {
    if(dp[S]==1&&(graph[i]&S)==S) dp[S|1<<i]=1;
  }
  
  rep(S,1<<N) for(ll T=S;;T=(T-1)&S) {
    chmin(dp[S],dp[T]+dp[S&~T]);
    if(!T) break;
  }
  
  cout<<dp[(1<<N)-1]<<'\n';
  
  return 0;
}