def dfs(n):
    if n in dp:
        return dp[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 j < k or k - i > D:
                continue
            S.discard(dfs(i) ^ dfs(j) ^ dfs(k))
    dp[n] = min(S)
    return dp[n]

L, D = map(int, input().split())
dp = dict()
print('kado' if dfs(L) > 0 else 'matsu')