#include #include #include using namespace std; int grundy[510]; void init_grundy(){ for(int i = 0; i < 6; i++){ grundy[i] = 0; } for(int i = 6; i < 510; i++){ grundy[i] = -1; } } int calc(int x, int d){ if(grundy[x] >= 0) return grundy[x]; set s; for(int i = 1; i < x / 3; i++){ for(int j = i + 1; j < (x - i + 1) / 2; j++){ int k = x - i - j; if(k - i <= d){ s.insert(calc(i, d) ^ calc(j, d) ^ calc(k, d)); } } } int res = 0; if(s.count(res)) res++; return res; } int main(){ int l, d, win = 0; cin >> l >> d; init_grundy(); win = calc(l, d); if(win){ cout << "kado" << endl; }else{ cout << "matsu" << endl; } return 0; }