L, D = map(int, input().split()) dp = [0] * (L + 1) for x in range(1, L + 1): s = set() for a in range(1, x): for b in range(a + 1, x): c = x - a - b if b < c and c - a <= D: xor = dp[a] ^ dp[b] ^ dp[c] s.add(xor) mex = 0 while 1: if mex not in s: break mex += 1 dp[x] = mex ans = "kado" if dp[L] else "matsu" print(ans)