L,D = map(int,input().split()) G = [-1 for i in range(L+1)] for x in range(6): G[x] = 0 for x in range(6,L+1): X = set() for i in range(L): for j in range(i+1,L): k = x - i - j if j >= k: break if k - i > D: continue g = G[i] ^ G[j] ^ G[k] X.add(g) g = 0 while g in X: g += 1 G[x] = g ans = 'kado' if G[L] == 0: ans = 'matsu' print(ans)