A = list(map(int, input().split('.'))) B = list(map(int, input().split('.'))) for i in range(3): if A[i] != B[i]: if B[i] < A[i]: print('YES') elif B[i] > A[i]: print('NO') break else: print('YES')