A = input().split(".") B = input().split(".") if int(A[0]) > int(B[0]): print("YES") elif int(A[0]) == int(B[0]): if int(A[1]) > int(B[1]): print("YES") elif int(A[1]) == int(B[1]): if int(A[2]) >= int(B[2]): print("YES") else: print("NO") else: print("NO") else: print("NO")