import sys from functools import lru_cache sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) L,D = MI() @lru_cache(maxsize=None) def Grundy(x): if x <= 5: return 0 G = set() for i in range(1,x//3): for j in range(i+1,x): k = x-i-j if k <= j: break if k-i > D: continue g = Grundy(i) ^ Grundy(j) ^ Grundy(k) G.add(g) for i in range(10**6): if not (i in G): return i g = Grundy(L) if g: print('kado') else: print('matsu')