s = ''.join(sorted(list(input())))
t = ''.join(sorted(list(input()),reverse=True))


if  s != t and s == sorted([s,t])[0]:
 print("Yes")
else:
 print("No")
36cb37931530c36184e4a212ecacf5eac9b927bb
<mask token>

<mask token>
if s != t and s == sorted([s, t])[0]:
    print('Yes')
else:
    print('No')

s = ''.join(sorted(list(input())))
t = ''.join(sorted(list(input()), reverse=True))
if s != t and s == sorted([s, t])[0]:
    print('Yes')
else:
    print('No')

s = ''.join(sorted(list(input())))
t = ''.join(sorted(list(input()),reverse=True))


if  s != t and s == sorted([s,t])[0]:
 print("Yes")
else:
 print("No")