a,b,c=map(int,input().split(".")) x,y,z=map(int,input().split(".")) s,t="","" for i in (a,b,c): i=f"{i:03d}" s+=str(i) for j in (x,y,z): j=f"{j:03d}" t+=str(j) # print(s,t) if int(s)>=int(t):print("YES") elif int(s)