s = sorted(eval(input()))

t = sorted(eval(input()))

t.reverse()



st = [s, t]

if st == sorted(st) and s != t:

    print("Yes")

else:

    print("No")
s = sorted(eval(input()))

t = sorted(eval(input()))

t.reverse()



ts = [t, s]

if ts != sorted(ts):

    print("Yes")

else:

    print("No")
s = sorted(eval(input()))
t = sorted(eval(input()))
t.reverse()
st = [s, t]
if st == sorted(st) and s != t:
    print("Yes")
else:
    print("No")

s = sorted(eval(input()))
t = sorted(eval(input()))
t.reverse()
ts = [t, s]
if ts != sorted(ts):
    print("Yes")
else:
    print("No")

-st = [s, t] -if st == sorted(st) and s != t: +ts = [t, s] +if ts != sorted(ts):