def dfs(n): S = set(range(n + 1)) for i in range(1, n + 1): for j in range(i + 1, n + 1): k = n - i - j if not i < j < k or k - i > D: break S.discard(dfs(i) ^ dfs(j) ^ dfs(k)) return min(S) L, D = map(int, input().split()) print('kado' if dfs(L) > 0 else 'matsu')