#include #include #include #define repeat(i,n) for (int i = 0; (i) < (n); ++(i)) #define repeat_from(i,m,n) for (int i = (m); (i) < (n); ++(i)) using namespace std; template int mex(C const & xs) { int y = 0; for (int x : xs) { // xs must be sorted (duplication is permitted) if (y < x) break; if (y == x) ++ y; } return y; } int main() { int l, d; cin >> l >> d; vector g(l+1); repeat (w,l+1) { set gs; repeat_from (x,1,l) { repeat_from (y,x+1,l) { int z = w-x-y; if (x < y and y < z and z <= x+d) { gs.insert(g[x] ^ g[y] ^ g[z]); } } } g[w] = mex(gs); } cout << (g[l] ? "kado" : "matsu") << endl; return 0; }