A = list(map(int, input().split('.'))) B = list(map(int, input().split('.'))) print(['YES', 'NO'][A < B])