s =eval(input())

t = eval(input())

s = sorted(s, key=str.lower)

t = sorted(t, key=str.lower, reverse=True)

s = ''.join(s)

t = ''.join(t)

l = [s,t]

l.sort()

if l[0] == s and s != t:

    print('Yes')

else:

    print('No')
s=eval(input())

t=eval(input())

s = sorted(s)

t = sorted(t, reverse=True)

if s < t:

    print('Yes')

else:

    print('No')
s = eval(input())
t = eval(input())
s = sorted(s, key=str.lower)
t = sorted(t, key=str.lower, reverse=True)
s = "".join(s)
t = "".join(t)
l = [s, t]
l.sort()
if l[0] == s and s != t:
    print("Yes")
else:
    print("No")

s = eval(input())
t = eval(input())
s = sorted(s)
t = sorted(t, reverse=True)
if s < t:
    print("Yes")
else:
    print("No")

-s = sorted(s, key=str.lower) -t = sorted(t, key=str.lower, reverse=True) -s = "".join(s) -t = "".join(t) -l = [s, t] -l.sort() -if l[0] == s and s != t: +s = sorted(s) +t = sorted(t, reverse=True) +if s < t: