#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

const ll INF=2e18;

bool overf(ll a,ll b){
  if(a>INF/b) return true;
  return false;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  string S;
  cin>>S;
  ll M;
  cin>>M;
  ll N=S.size();

  int madig=0;
  rep(i,N) chmax(madig,S[i]-'0');

  auto calc = [&](ll d){
    ll milim=1;
    bool ng=false;
    rep(i,N-1){
      if(overf(milim,d)){
        ng=true;
        break;
      }
      milim*=d;
    }
    if(ng) return -INF;

    ll num=0;
    bool ov=false;
    rep(i,N){
      if(overf(num,d)){
        ov=true;
        break;
      }
      num*=d;
      ll c=S[i]-'0';
      num+=c;
    }

    if(ov) return -INF;
    if(num>M) return -INF;
    return num;
  };

  if(calc(madig+1)==-INF){
      cout<<0<<endl;
      return 0;
  }

  {
      ll high=M+1,low=madig+1;
      while(abs(high-low)>3){
          ll mid=(high+low)/2;
          ll prev=calc(mid);
          ll nexv=calc(mid+1);
          if(prev==-INF) high=mid;
          else if(nexv==-INF) high=mid+1;
          else if(prev==nexv) high=mid;
          else low=mid;
      }

      for(ll d=low;d<=high;d++){
          ll prev=calc(d);
          ll nexv=calc(d+1);
          if(nexv==-INF||prev==nexv){
              cout<<d-madig<<endl;
              return 0;
          }
      }
  }

  return 0;
}

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

int H, W;
int dp[2009][2009], score[2009][2009];
char c[2009][2009];

int main() {
    cin >> H >> W;
    for(int i=1; i<=H; i++) {
        for(int j=1; j<=W; j++) {
            cin >> c[i][j];
            if(c[i][j] == '+') score[i][j] = 1;
            else score[i][j] = -1;
        }
    }

    for(int i=H; i>=1; i--) {
        for(int j=W; j>=1; j--) {
            if(i == H && j == W) {
                dp[i][j] = 0;
            }
            // 高橋くん
            else if((i+j) % 2 == 0) {
                dp[i][j] = -(1 << 30);
                if(i + 1 <= H) dp[i][j] = max(dp[i][j], dp[i+1][j] + score[i+1][j]);
                if(j + 1 <= W) dp[i][j] = max(dp[i][j], dp[i][j+1] + score[i][j+1]);
            }

            // 青木くん
            else {
                dp[i][j] = (1 << 30);
                if(i + 1 <= H) dp[i][j] = min(dp[i][j], dp[i+1][j] - score[i+1][j]);
                if(j + 1 <= W) dp[i][j] = min(dp[i][j], dp[i][j+1] - score[i][j+1]);
            }
        }
    }

    if(dp[1][1] > 0) cout << "Takahashi" << endl;
    else if(dp[1][1] < 0) cout << "Aoki" << endl;
    else cout << "Draw" << endl;
    return 0;
}