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 s>=t:print("YES") elif s