a = tuple(map(int, input().split('.'))) b = tuple(map(int, input().split('.'))) print(['YES', 'NO'][a < b])