#include<bits/stdc++.h>
#define int long long
#define rg register
#define il inline
#define TT(T, Args) template<typename T, typename... Args>
#define up(i, a, b) for (rg int i = (a); i <= (b); i++)
#define down(i, a, b) for (rg int i = (a); i >= (b); i--)
#define rep(i, a) for (rg auto i : a)
using namespace std;
namespace xmpl_{
#define SIZE (1 << 24)
namespace Fast_read{
char buf[SIZE], *S, *T;
il char Getchar(){
if (S == T){
T = (S = buf) + fread(buf, 1, SIZE, stdin);
if (S == T) return '\n';
}
return *S++;
}
}
namespace Fast_write{
char buf[SIZE], *S = buf, *T = buf + SIZE;
il void flush(){
fwrite(buf, 1, S - buf, stdout);
S = buf;
}
il void Putchar(char c){
*S++ = c;
if (S == T) flush();
}
struct F{
~F(){
flush();
}
}fly;
#undef SIZE
}
#define gc Fast_read::Getchar
#define pc Fast_write::Putchar
il int fast_rd(){
int f = 1, x = 0;
char ch = gc();
while(ch < '0' || ch > '9'){
if (ch == '-') f = -1;
ch = gc();
}
while(ch >= '0' && ch <= '9'){
x = x * 10 + ch - '0';
ch = gc();
}
return x * f;
}
il void fast_wt(int x){
if (x < 0){
pc('-');
x = -x;
}
if (x > 9) fast_wt(x / 10);
pc(x % 10 + 48);
}
il string fast_rds(){
string s = "";
char ch = gc();
while((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')){
s += ch;
ch = gc();
}
return s;
}
il void fast_wts(string s){
for (int i = 0; i < s.size(); i++) pc(s[i]);
}
il int rd(){
int f = 1, x = 0;
char ch = getchar();
while(ch < '0' || ch > '9'){
if (ch == '-') f = -1;
ch = getchar();
}
while(ch >= '0' && ch <= '9'){
x = x * 10 + ch - '0';
ch = getchar();
}
return x * f;
}
TT(T, Args) il void rd(T &x){
int f = 1;
x = 0;
char ch = getchar();
while(ch < '0' || ch > '9'){
if (ch == '-') f = -1;
ch = getchar();
}
while(ch >= '0' && ch <= '9'){
x = x * 10 + ch - '0';
ch = getchar();
}
x *= f;
}
TT(T, Args) il void rd(T &x, Args &...args){
rd(x), rd(args...);
}
TT(T, Args) il void fast_rd(T &x){
int f = 1;
x = 0;
char ch = gc();
while(ch < '0' || ch > '9'){
if (ch == '-') f = -1;
ch = gc();
}
while(ch >= '0' && ch <= '9'){
x = x * 10 + ch - '0';
ch = gc();
}
x *= f;
}
TT(T, Args) il void fast_rd(T &x, Args &...args){
fast_rd(x), fast_rd(args...);
}
il void wt(int x){
if (x < 0){
putchar('-');
x = -x;
}
if (x > 9) wt(x / 10);
putchar(x % 10 + 48);
}
il string rds(){
string s = "";
char ch = getchar();
while((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')){
s += ch;
ch = getchar();
}
return s;
}
il void wts(string s){
for (int i = 0; i < s.size(); i++) putchar(s[i]);
}
il int max(int x, int y){
return (x > y ? x : y);
}
il int min(int a, int b){
return (a < b ? a : b);
}
il int max(int x, int y, int z){
return max(x, max(y, z));
}
il int min(int a, int b, int c){
return min(a, min(b, c));
}
il int qmul(int a, int b, int p){
int res = 0;
while(b){
if (b & 1) res = (res + a) % p;
a = (a + a) % p;
b >>= 1ll;
}
return res;
}
il int qpow(int a, int b, int p){
int res = 1;
while(b){
if (b & 1) res = qmul(res, a, p);
a = qmul(a, a, p);
b >>= 1ll;
}
return res;
}
const int Q = 1e6 + 5;
int fac[Q] = {0}, inv[Q] = {0}, finv[Q] = {0};
il void init(int n, int p){
fac[0] = inv[0] = finv[0] = fac[1] = inv[1] = finv[1] = 1;
for (int i = 2; i <= n; i++){
fac[i] = 1ll * fac[i - 1] * i % p;
inv[i] = (p - 1ll * p / i * inv[p % i] % p) % p;
finv[i] = 1ll * finv[i - 1] * inv[i] % p;
}
}
il int A(int n, int m, int p){
if (m > n || m < 0) return 0;
return 1ll * fac[n] * finv[n - m] % p;
}
il int C(int n, int m, int p){
if (m > n || m < 0) return 0;
return 1ll * fac[n] * finv[m] % p * finv[n - m] % p;
}
il int Lucas(int n, int m, int p){
if (!m) return 1;
return (1ll * C(n % p, m % p, p) * Lucas(n / p, m / p, p)) % p;
}
il int gcd(int a, int b){
if (!b) return a;
return gcd(b, a % b);
}
il int lcm(int a, int b){
return 1ll * a * b / gcd(a, b);
}
const int W = 1e5 + 5;
struct int64{
int d[W];
int64(){
memset(d, 0, sizeof(d));
d[0] = 1;
}
int64(int x){
int64();
int it = 0;
while(x){
d[++it] = x % 10;
x /= 10;
}
d[0] = it;
}
bool operator < (const int64 &x) const{
if (d[0] ^ x.d[0]) return d[0] < x.d[0];
int it = d[0];
while(d[it] == x.d[it] && it > 1) it--;
if (it >= 1) return d[it] < x.d[it];
else return 0;
}
int64 operator * (const int &x){
int64 ans;
int len;
ans.d[0] = d[0];
for (int i = 1; i <= d[0]; i++) ans.d[i] = d[i] * x;
for (int i = 1; i <= ans.d[0] || ans.d[i]; i++){
ans.d[i + 1] += ans.d[i] / 10;
ans.d[i] %= 10;
len = i + 1;
}
ans.d[0] = len;
if (!ans.d[len]) ans.d[0]--;
return ans;
}
int64 operator / (const int &x){
int64 ans;
ans.d[0] = d[0];
int res = 0;
for (int i = d[0]; i >= 1; i--){
res = res * 10 + d[i];
ans.d[i] = res / x;
res %= x;
}
while(!ans.d[ans.d[0]] && ans.d[0] > 1) ans.d[0]--;
return ans;
}
};
std::ostream &operator << (std::ostream &ans, const int64 &x){
for (int i = x.d[0]; i >= 1; i--) ans << x.d[i];
return ans;
}
}
using namespace xmpl_;
using namespace std;
const int N = 2e5 + 5, M = 4e5 + 5, K = 2e6 + 5, p = 998244353;
int n, d[M], ans[M], len[N], id;
bool vis[M];
map<string, int> idx;
string s[N];
queue<int> q;
vector<int> g[M];
il void init(){
}
il void clear(){
}
il int get(string t){
if (!idx[t]) idx[t] = ++id;
}
il void work(){
cin >> n;
up(i, 1, n) cin >> s[i], len[i] = s[i].size(), s[i] = " " + s[i];
up(i, 1, n){
string t = s[i], t1 = t.substr(1, 3), t2 = t.substr(len[i] - 2, 3);
get(t1), get(t2);
g[idx[t2]].push_back(idx[t1]), d[idx[t1]]++;
}
memset(ans, -1, sizeof(ans));
up(i, 1, id) if (!d[i]) q.push(i), ans[i] = 0;
while(q.size()){
int u = q.front();
q.pop();
rep(v, g[u]){
d[v]--;
if (!ans[u] && !~ans[v]) ans[v] = 1, vis[v] = 1;
if (ans[u] && !~ans[v] && !vis[v]) ans[v] = 0;
q.push(v);
}
}
up(i, 1, n){
string t = s[i], t2 = t.substr(len[i] - 2, 3);
cout << ((ans[idx[t2]] == 1) ? "Aoki\n" : (ans[idx[t2]] == 0 ? "Takahashi\n" : "Draw\n"));
}
}
signed main(){
#ifdef file
freopen("code.in", "r", stdin);
freopen("code.out", "w", stdout);
#endif
int t = 1;
while(t--){
work();
}
return 0;
}