#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
ll h,w;
vector<vector<char>> t(2010,vector<char>(2010));
int roty[2]={1,0},rotx[2]={0,1};

int main(void){
    cin>>h>>w;
    rep(i,h)rep(j,w){
        cin>>t[i][j];
    }
    vector<vector<ll>> d(h,vector<ll>(w,0));
    for(int y=h-1;y>=0;y--){
        for(int x=w-1;x>=0;x--){
            ll tot=-1e9;
            if(y==h-1&&x==w-1){
                d[y][x]=0;
                continue;
            }
            rep(k,2){
                ll ny=y+roty[k],nx=x+rotx[k];
                if(ny<0||ny>=h||nx<0||nx>=w)continue;
                ll buf=(t[ny][nx]=='+')? 1:-1;
                buf-=d[ny][nx];
                chmax(tot,buf);
            }
            d[y][x]=tot;
        }
    }
    ll res=d[0][0];
    if(res>0)cout<<"Takahashi"<<endl;
    else if(res==0)cout<<"Draw"<<endl;
    else cout<<"Aoki"<<endl;
}
#include<bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A,value) memset(A,value,sizeof(A))
#define endl '\n'

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second

typedef long long ll;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector<ll> vl;
typedef pair <int, int> pi;
typedef pair <ll, int> pl;
typedef pair <ll, ll> pll;
typedef pair <double, double> pd;

//change these according to prob constraints
const int INF = 0x3f3f3f3f;
const int MAX = 100005;
const int MAX1 = 1005;
const int MAX2 = 105;
const int LEN = 105;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1000000007;
//g++ -std=c++11 your_file.cpp -o your_program

ll mypow(ll a, ll b){
	ll ans=1;
	while(b){
		if(b&1)
			ans=(ans*a)%MOD;
		b/=2;
		a=(a*a)%MOD;
	}
	return ans;
}

string x;
ull m;

bool solve(ull mid){
    ull curr = 0;
    ull pow = 1;
    RREP(i, SZ(x)){
        if (pow > m) return 0;
        curr += (ull)((ull)x[i] - '0') * pow;
        if (curr > m) return 0;
        pow = pow * mid;
    }
    return 1;
}

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ifstream in("");
	ofstream out("");
	clock_t begin = clock();
    cin >> x >> m;
    if (SZ(x) == 1){
        if (stoll(x) > m){
            cout << 0 << endl;
        }
        else cout << 1 << endl;
        return 0;
    }
    int d = 0;
    REP(i, SZ(x)){
        d = max(d, (int)x[i] - '0');
    }
    ull lo = d + 1, hi = 10e18, mid, ans = d;
    while (lo <= hi){
        mid = (lo + hi) / 2;
        if (solve(mid)){
            lo = mid + 1;
            ans = max(ans, mid);
        }
        else hi = mid - 1;
    }
    cout << ans - d << endl;
	clock_t end = clock();
    double esecs = double(end - begin) / CLOCKS_PER_SEC;
    //cout << esecs << " seconds" << endl;
	return 0;	
}