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