#include<bits/stdc++.h>
using namespace std;
#define int long long
int n;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int n;
int k;
cin>>n>>k;
while (n--) {
string s;
cin>>s;
int p=1;
bool f=1;
for (char c:s) {
int d=c-'0';
if (d==0) {
p=0;
break;
} if (p>k/d) {
f=0;
break;
}
p*=d;
}
if(f)cout<<"kawaii"<<endl;
else cout<<"dame"<<endl;
}
return 0;
}