s1=eval(input())

s2=eval(input())

if s1 == s2:

    print('No')

    exit()

s1 = list(s1)

s1.sort()

s1 = ''.join(map(str,s1))

s2 = list(s2)

s2.sort(reverse=True)

s2 = ''.join(map(str,s2))

check = [s1,s2]

check.sort()



if check[0] == s1:

    print('Yes')

else:

    print('No')

S = list(eval(input()))

T = list(eval(input()))



S.sort()

T.sort(reverse=True)



s = ''.join(map(str,S))

t = ''.join(map(str,T))



if t > s:

    print('Yes')

else:

    print('No')
s1 = eval(input())
s2 = eval(input())
if s1 == s2:
    print("No")
    exit()
s1 = list(s1)
s1.sort()
s1 = "".join(map(str, s1))
s2 = list(s2)
s2.sort(reverse=True)
s2 = "".join(map(str, s2))
check = [s1, s2]
check.sort()
if check[0] == s1:
    print("Yes")
else:
    print("No")

S = list(eval(input()))
T = list(eval(input()))
S.sort()
T.sort(reverse=True)
s = "".join(map(str, S))
t = "".join(map(str, T))
if t > s:
    print("Yes")
else:
    print("No")

-s1 = eval(input()) -s2 = eval(input()) -if s1 == s2: -    print("No") -    exit() -s1 = list(s1) -s1.sort() -s1 = "".join(map(str, s1)) -s2 = list(s2) -s2.sort(reverse=True) -s2 = "".join(map(str, s2)) -check = [s1, s2] -check.sort() -if check[0] == s1: +S = list(eval(input())) +T = list(eval(input())) +S.sort() +T.sort(reverse=True) +s = "".join(map(str, S)) +t = "".join(map(str, T)) +if t > s: