abc0 = input().split('.') abc1 = input().split('.') if abc1 < abc0: print('YES') else: print('NO')