N,M=map(int,raw_input().split())
lines=[]
blocked=[False for i in range(M)]
used=[False for i in range(N)]
for i in range(N):
    L,R=map(int,raw_input().split())
    lines.append(((L,R),(M-R-1,M-L-1)))

useCnt=0
while useCnt < N:
    toCheck=[]
    for i in range(N):
        if used[i]==False:
            toCheck.append((i,0))
            used[i]=True
            break
    while len(toCheck)!=0:
        p,q=toCheck[0]
        toCheck.pop(0)
        l,r=lines[p][q]
        useCnt+=1
        for c in range(l,r+1):
            if blocked[c]==True:
                print "NO"
                exit()
            blocked[c]=True
            for t in range(N):
                if used[t]==False:
                    if lines[t][0][0]<=c and lines[t][0][1]>=c and lines[t][1][0]<=c and lines[t][1][1]>=c:
                        print "NO"
                        exit()
                    elif lines[t][0][0]<=c and lines[t][0][1]>=c :
                        toCheck.append((t,1))
                        used[t]=True
                    elif lines[t][1][0]<=c and lines[t][1][1]>=c :
                        toCheck.append((t,0))
                        used[t]=True
print "YES"