l, d = map(int, input().split()) N = 550 grundy = [-1]*N grundy[1] = 0 grundy[2] = 0 def rec(x): if grundy[x] != -1: return grundy[x] S = set() for l1 in range(1, x-1): for l2 in range(1, x-1): l3 = x-l1-l2 if l3 <= 0: continue if l1 == l2 or l2 == l3 or l3 == l1: continue if max(l1, l2, l3)-min(l1, l2, l3) <= d: g = rec(l1)^rec(l2)^rec(l3) S.add(g) g = 0 while True: if g not in S: break else: g += 1 grundy[x] = g return g g = rec(l) if g == 0: print('matsu') else: print('kado')