A0,B0,C0 = map(int,input().split(".")) A1,B1,C1 = map(int,input().split(".")) if A0 < A1: print("NO") elif A0 > A1: print("YES") else: if B0 < B1: print("NO") elif B0 > B1: print("YES") else: if C0 < C1: print("NO") else: print("YES")