#include #define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++) using namespace std; typedef long long ll; ll L, D; bool ok(ll l1, ll l2, ll l3, ll l) { if(l1 + l2 + l3 == l) if(l1 != l2 && l2 != l3 && l3 != l1) if(l1 > 0 && l2 > 0 && l3 > 0) if(max({ l1, l2, l3 }) - min({ l1, l2, l3 }) <= D) return true; return false; } ll grundy(ll l) { set st; REP(i, 1, l + 1) REP(j, i + 1, l + 1) { ll k = l - i - j; if(ok(i, j, k, l)) st.insert(grundy(i) ^ grundy(j) ^ grundy(k)); } ll g = 0; while(st.count(g)) g++; return g; } int main(void) { cin >> L >> D; cout << (grundy(L) != 0 ? "kado" : "matsu") << endl; }