a = map(int, raw_input().split('.')) b = map(int, raw_input().split('.')) if a[0] < b[0]: print 'NO' elif a[1] < b[1]: print 'NO' elif a[2] < b[2]: print 'NO' else: print 'YES'