s = input().split(".") p = input().split(".") S = [int(i) for i in s] P = [int(j) for j in p] if S == P: print("YES") else: for i in range(3): if S[i] > P[i]: print("YES") break elif S[i] < P[i]: print("NO") break else: continue