#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
int H, W;
int pt(char c){
    if(c == '+') return 1;
    else return -1;
}
bool inarea(int y, int x){
    if(0 <= y && y < H && 0 <= x && x < W) return true;
    else return false;
}
int toint(int y, int x){
    return y * W + x;
}
pair<int, int> topair(int N){
    int x = N % W;
    int y = (N - x) / W;
    return make_pair(y, x);
}
int main(){
    cin >> H >> W;
    vector<vector<char>> A(H, vector<char> (W));
    rep(i, H) rep(j, W){
        cin >> A[i][j];
    }
    int dp[4000000];
    rep(i, H * W - 1){
        int y = topair(i).first;
        int x = topair(i).second;
        if((y + x) % 2 == 0) dp[i] = -1e9;
        else dp[i] = 1e9;
    }
    dp[H * W - 1] = 0;
    dp[H*W-1] = 0;
    int dy[2] = {1, 0};
    int dx[2] = {0, 1};
    queue<int> todo;
    todo.push(H * W - 1);
    vector<bool> seen(H * W, false);
    seen[H * W - 1] = true;
    while(!todo.empty()){
        int v = todo.front();
        todo.pop();
        int y = topair(v).first;
        int x = topair(v).second;
        rep(i, 2){
            int ny = y - dy[i];
            int nx = x - dx[i];
            if(!inarea(ny, nx)) continue;
            if(seen[toint(ny, nx)]) continue;
            seen[toint(ny, nx)]  = true;
            todo.push(toint(ny, nx));
            rep(j, 2){
                int nny = ny + dy[j];
                int nnx = nx + dx[j];
                if(!inarea(nny, nnx)) continue;
                if((ny + nx) % 2 == 1){
                    dp[toint(ny, nx)] = min(-pt(A[nny][nnx]) + dp[toint(nny, nnx)], dp[toint(ny, nx)]);
                }
                else{
                    dp[toint(ny, nx)] = max(pt(A[nny][nnx]) + dp[toint(nny, nnx)], dp[toint(ny, nx)]);
                }
            }   
        }
    }
    if(dp[0] > 0) cout << "Takahashi" << endl;
    else if(dp[0] < 0) cout << "Aoki" << endl;
    else cout << "Draw" << endl;
}
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
template<typename T> using V = std::vector<T>;
template<typename T> void fill(V<T>&v) { for(T&e:v) std::cin >> e; }
/*-*/

lnt MOD = 998244353;
struct mint
{
	lnt v;
	mint():v(0){}
	mint(lnt v):v((v+MOD)%MOD){}
	mint operator-()const{ return mint(0) - *this; }
	mint& operator+=(const mint& a){ if((v+=a.v)>=MOD) v-=MOD; return *this; }
	mint& operator-=(const mint& a){ if((v+=MOD-a.v)>=MOD) v-=MOD; return *this; }
	mint& operator*=(const mint& a){ (v*=a.v)%=MOD; return *this; }
	mint& operator/=(const mint& a){ (*this) *= a.inv(); return *this; }
	mint operator+(const mint& a)const{ return mint(*this) += a; }
	mint operator-(const mint& a)const{ return mint(*this) -= a; }
	mint operator*(const mint& a)const{ return mint(*this) *= a; }
	mint operator/(const mint& a)const{ return mint(*this) /= a; }
	bool operator<(const mint& a)const{ return v < a.v; }
	bool operator==(const mint& a)const{ return v == a.v; }
	mint pow(lnt k)const{ mint r(1),t(v); while(k){ if(k&1) r*=t; t*=t; k>>=1; } return r; }
	mint inv()const{ return pow(MOD-2); }
	static mint comb(lnt n, lnt k) { if(n-k<k) k=n-k; mint num(1), dom(1); for(int i=0;i<k;i++) { num*=n-i; dom*=i+1; } return num/dom; }
	static std::vector<mint> construct_comb(int n) {
		std::vector<mint> c(n+1); mint a = 1; c[0] = a; for(int i=1;i<=n;i++) { a = a*mint(n+1-i)/i; c[i] = a; } return c;
	}
	static std::vector<mint> construct_fact(int n) { std::vector<mint> f(n+1,1); for(int i=2;i<=n;i++) f[i]=f[i-1]*i; return f; }
};
std::istream& operator>>(std::istream&i,mint&a){ lnt t; i>>t; a=mint(t); return i; }
std::ostream& operator<<(std::ostream&o,const mint&a){ o<<a.v; return o; }


int main() {
	int n,k;
	lnt m;
	std::cin >> n >> k >> m;
	MOD=m;
	lnt N=n*(n+1)/2;
	V<V<mint> > pre(n+1,V<mint>(N*k+1,0));
	{ // precompute
		pre[0][0]=1;
		for(int i=1;i<=n;i++) {
			rep(j,N*k+1) {
				if(j==0) pre[i][j]=1;
				else {
					if(j-i<0) pre[i][j]=pre[i-1][j];
					else pre[i][j]=pre[i][j-i]+pre[i-1][j];
				}
			}
			for(int j=N*k;j>=0;j--) {
				if(j-(k+1)*i<0) break;
				pre[i][j]-=pre[i][j-(k+1)*i];
			}
		}
	}
	for(int x=1;x<=n;x++) {
		mint ans=0;
		// up to n-x and up to x-1
		rep(i,N*k+1) {
			ans+=pre[x-1][i]*pre[n-x][i]*mint(k+1);
		}
		print(ans-1);
	}
}
