f = input().replace('.','') s = input().replace('.','') if s < f: print('YES') else: print('NO')