a = list(map(int, input().split('.'))) b = list(map(int, input().split('.'))) for i in range(3): if a[i] < b[i]: print('NO') break else: print('YES')