L,D=map(int,raw_input().split()) ans=[0,0,0,0,0,0] for i in range(6,L+1): grundy=0 for j in range(1,i+1): for k in range(j+1,i+1): l=i-j-k if l<=k: continue if l-j > D: continue num=ans[j]^ans[k]^ans[l] if( num == 0 ): grundy=1 ans.append(grundy) if ans[L]==0: print "matsu" else: print "kado"