a = raw_input().split('.') b = raw_input().split('.') old = True for i,j in zip(a,b): if i < j: old = False break if old: print 'YES' else: print 'NO'