A=list(map(int,input().split('.'))) B=list(map(int,input().split('.'))) A[0]<<=16 A[1]<<=8 B[0]<<=16 B[1]<<=8 O='YES' if sum(B)>sum(A):O='NO' print(O)