if map(int, raw_input().split('.')) < map(int, raw_input().split('.')): print 'NO' else: print 'YES'