#include<bits/stdc++.h>
using namespace std;
int n,k;
bool f(string a)
{
long long cnt=a[0]-'0';
for(int i=1;i<a.size();i++)
{
if(a[i]=='0') return true;
cnt*=a[i]-'0';
if(cnt>k) return false;
}
return true;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>n>>k;
while(n--)
{
string s;
cin>>s;
if(f(s)) cout<<"kawaii"<<endl;
else cout<<"dame"<<endl;
}
return 0;
}