N,M=map(int,input().split()) L=list() R=list() D=list() for i in range(N): A,B,C=map(int,input().split()) L.append(B) R.append([A,B,C]) D.append([max(A,C),i]) if A==C: print("NO") exit() L.sort() L.reverse() D.sort() thi=0 ans=0 usiro=N-1 for i in range(N): a,b=D[i] if L[thi]>a: ans+=L[thi] thi+=1 else: if L[usiro]=M: print("KADOMATSU!") else: print("NO")