Problem:
 Score : 200 points    Problem Statement You are given strings s and t , consisting of lowercase English letters.
You will create a string s' by freely rearranging the characters in s .
You will also create a string t' by freely rearranging the characters in t .
Determine whether it is possible to satisfy s' < t' for the lexicographic order.      Notes For a string a = a_1 a_2 ... a_N of length N and a string b = b_1 b_2 ... b_M of length M , we say a < b for the lexicographic order if either one of the following two conditions holds true:   N < M and a_1 = b_1 , a_2 = b_2 , ..., a_N = b_N .  There exists i ( 1 \leq i \leq N, M ) such that a_1 = b_1 , a_2 = b_2 , ..., a_{i - 1} = b_{i - 1} and a_i < b_i . Here, letters are compared using alphabetical order.   For example, xy  <  xya and atcoder  <  atlas .      Constraints  The lengths of s and t are between 1 and 100 (inclusive).  s and t consists of lowercase English letters.         Input Input is given from Standard Input in the following format:  s  t       Output If it is possible to satisfy s' < t' , print Yes ; if it is not, print No .        Sample Input 1 yx
axy      Sample Output 1 Yes  We can, for example, rearrange yx into xy and axy into yxa . Then, xy  <  yxa .       Sample Input 2 ratcode
atlas      Sample Output 2 Yes  We can, for example, rearrange ratcode into acdeort and atlas into tslaa . Then, acdeort  <  tslaa .       Sample Input 3 cd
abc      Sample Output 3 No  No matter how we rearrange cd and abc , we cannot achieve our objective.       Sample Input 4 w
ww      Sample Output 4 Yes       Sample Input 5 zzz
zzz      Sample Output 5 No

Solution (Python):
S = sorted(list(input()))
T = sorted(list(input()))[::-1]
if S == T:
    print("No")
    exit()
s = ""
t = ""
for x in S:
    s += x
for x in T:
    t += x
compare_place = sorted([s,t])
if compare_place[0] == s:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
t = input()

s = sorted(s)
t = sorted(t,reverse=True)

if s<t:
  print("Yes")
else:
  print("No")

Solution (Python):
s = sorted(input())
t = sorted(input())[::-1]
print(["No","Yes"][s<t])

Solution (Python):

def db(x): 
    global debug
    if debug: print(x)
debug = False
s = input()
sl = [c for c in s]
t = input()
tl = [c for c in t]
sl.sort()
tl.sort()
tl.reverse()
db((sl,tl))
for i in range(min(len(s),len(t))):
    if sl[i]<tl[i]:
        print('Yes')
        break
    elif  sl[i]>tl[i]:
        print('No')
        break
else:
    if len(s)<len(t):
        print('Yes')
    else: print('No')

Solution (Python):
s = input()
t = input()
s=sorted(s)
t=sorted(t,reverse=True)
print('Yes' if s<t else 'No')

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
s = ''.join(s)
t = ''.join(t)
if s < t:
  print('Yes')
else:
  print('No')

Solution (Python):
s = input()
t = input()

s = sorted(s)
t = sorted(t,reverse = True)

if s < t:
  print('Yes')
else:
  print('No')

Solution (Python):
from sys import stdin
 
s = stdin.readline().rstrip()
t = stdin.readline().rstrip()
s = sorted(s)
t = sorted(t,reverse =True)
tmp1 =("".join(s))
tmp2 =("".join(t))
if tmp1 < tmp2 :print('Yes')
else:print('No')

Solution (Python):
s = list(input())
t = list(input())

s = sorted(s)
t = sorted(t, reverse=True)

if s < t:
  print('Yes')
else:
  print('No')

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

if s<t:
  print("Yes")
else:
  print("No")

Solution (Python):
def main():
    s = input()
    t = input()

    s = "".join(sorted(s))
    t = "".join(sorted(t, reverse=True))

    if s < t:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):
s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)

if ''.join(s) < ''.join(t):
    print('Yes')
else:
    print('No')

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
S = ''.join(s)
T = ''.join(t)

if S < T:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
t = input()
if ''.join(sorted(s)) < ''.join(sorted(t, reverse=True)):
    print('Yes')
else:
    print('No')

Solution (Python):
s = str(input())
t = str(input())
S = list(s)
S.sort()
T = list(t)
T.sort(reverse=True)
if S < T:
    print("Yes")
else:
    print("No")

Solution (Python):
s = list(input())
t = list(input())
subset = True
ans = ""
for i in range(min(len(s),len(t))):
    s_n = s.pop(s.index(min(s)))
    t_n = t.pop(t.index(max(t)))
    if s_n != t_n:
        subset = False
        if s_n < t_n:
            ans = "Yes"
        else:
            ans = "No"
        break
if subset == True:
    if len(s) < len(t):
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Solution (Python):
s = ''.join(sorted(list(input())))
t = ''.join(sorted(list(input()), reverse = True))
if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
if (s<t):
  print("Yes")
else:
  print("No")

Solution (Python):
s = sorted(input())
t = sorted(input())
print('Yes') if s < t[::-1] else print('No')

Solution (Python):
s = sorted(input())
t = sorted(input())

if s < t[::-1]:
    print('Yes')
else:
    print('No')

Solution (Python):
ss = input()
ts = input()

print('Yes' if sorted(ss) < sorted(ts, reverse=True) else 'No')

Solution (Python):
def inpl(): return list(map(int, input().split()))

S = list(input())
T = list(input())
S.sort()
T.sort(reverse=True)

for i in range(min(len(S), len(T))):
    if S[i] < T[i]:
        print("Yes")
        exit()
    elif S[i] == T[i]:
        continue
    else:
        print("No")
        exit()
if len(S) >= len(T):
    print("No")
else:
    print("Yes")

Solution (Python):
S = input()
T = input()

SS = [s for s in S]
TT = [t for t in T]
SS.sort()
TT.sort(reverse=True)
S = "".join(SS)
T = "".join(TT)

print("Yes" if S<T else "No")

Solution (Python):
s = input()
t = input()

s_new = sorted(s)
t_new = sorted(t,reverse = True)

if s_new < t_new:
	print("Yes")
else:
	print("No")

Solution (Python):
n=list(input())
n.sort()
p=list(input())
p.sort()
p=p[::-1]
d=[n,p]
d.sort()
print("Yes"if d[0]!=p else"No")

Solution (Python):


a = [a for a in input()]
b = [a for a in input()]

l = ["".join(sorted(a)), "".join(sorted(b, reverse=True))]

if l[0] == l[1]:
    print("No")
elif l == sorted(l):
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
t = input()

s_asc = ''.join(sorted(s))
t_dec = ''.join(sorted(t,reverse=True))

if s_asc<t_dec:
    print('Yes')
else:
    print('No')

Solution (Python):
s=list(input())
t=list(input())
s.sort()
t.sort()
t.reverse()
print('Yes'if ''.join(s)<''.join(t)else'No')

Solution (Python):
a=[i for i in input()]
b=[i for i in input()]
a=sorted(a)
b=sorted(b)
b=b[::-1]




hantei=True
if len(a)<len(b):
	for i in range(len(a)):
		if a[i]>b[i]:
			hantei=False
			break
		elif a[i]<b[i]:
			hantei=True
			break
else:
	hantei=False
	for i in range(len(b)):
		if a[i]>b[i]:
			hantei=False
			break
		elif a[i]<b[i]:
			hantei=True
			break
if hantei == True:
	print("Yes")
else:
	print("No")

Solution (Python):

import sys

s = list(input())
t = list(input())


s.sort()

t.sort(reverse=True)

n = 0
if len(s) >= len(t) :
    n = len(t)
else :
    n = len(s)

for i in range(n) :
    if s[i] < t[i] :
        print('Yes')
        exit()
    elif s[i] > t[i] :
        print('No')
        exit()

if len(s) < len(t) :
    print('Yes')
else :
    print('No')

Solution (Python):
s = sorted(input())
t = sorted(input(), reverse = True)
if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
print("Yes" if sorted(input())<sorted(input())[::-1] else "No")

Solution (Python):
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
if "".join(s)<"".join(t):
  print("Yes")
else:
  print("No")

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort()
A = []
B = []
for i in s:
    A.append(ord(i))
for j in t:
    B.append(ord(j))
count=0
if(min(A)<max(B)):
    print("Yes")
    count+=1
else:
    for i in range(min(len(A), len(B))):
        if(min(A)> max(B)):
            print("No")
            count+=1
            break
if(len(set(A)) == len(set(B)) and len(A)<len(B) and count==0):
    print("Yes")
    count+=1
if(count==0):
    print("No")

Solution (Python):
s = str(sorted(list(input()))).replace(']', '').replace('[', '').replace(',', '')
t = str(sorted(list(input()), reverse=True)).replace(']', '').replace('[', '').replace(',', '')

if str(s)<str(t):
    print('Yes')
else:
    print('No')

Solution (Python):
S = sorted(input())
T = sorted(input(), reverse = True)
if(S < T):
  print('Yes')
else:
  print('No')

Solution (Python):
S = sorted(input())
T = sorted(input(), reverse = True)
if(S < T):
  print('Yes')
else:
  print('No')

Solution (Python):
print("Yes" if ''.join(sorted(input())) < ''.join(reversed(sorted(list(input())))) else "No")

Solution (Python):
import sys

input = sys.stdin.readline
s = input()[:-1]
t = input()[:-1]
print("Yes" if sorted(s) < sorted(t)[::-1] else "No")

Solution (Python):
s = list(input())
t = list(input())
S = ''
T = ''
s.sort()
t.sort(reverse = True)
for c in s:
    S += c
for c in t:
    T += c
if S < T:
    print('Yes')
else:
    print('No')

Solution (Python):
s=input()

t=input()


s=[ord(i) for i in s]
s.sort()

t=[ord(i) for i in t]
t.sort()


flag=0
for i in range(len(s)):
  for j in range(len(t)):
    if s[i] < t[j]:
      flag=1
    elif len(s) < len(t) and s==t[:len(s)]:
      flag=1
      
print('Yes' if flag==1 else 'No')

Solution (Python):
import sys

lines = sys.stdin.readlines()
s = [ord(c) - 96 for c in lines[0].strip()]
t = [ord(c) - 96 for c in lines[1].strip()]

def check(s, t):
  if not len(s) and len(t):
    print('Yes')
    return
  elif not len(t) and len(s):
    print('No')
    return
  elif not len(s) and not len(t):
    print('No')
    return
    
  if min(s) < max(t):
    print('Yes')
  elif min(s) > max(t):
    print('No')
  else:
    s.remove(min(s))
    t.remove(max(t))
    return check(s, t)

check(s, t)

Solution (Python):
S = str(input())
T = str(input())
S = sorted(S)
T = sorted(T,reverse = True)
list = [S,T]
list = sorted(list)
if list[0] == list[1]:
    print("No")
elif list[0] == S:
    print("Yes")
else:
    print("No")

Solution (Python):
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
print("YNeos"[s>=t::2])

Solution (Python):

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

Solution (Python):


def main():
    s = input()
    t = input()

    s_bytes = sorted(s.encode())
    t_bytes = sorted(t.encode(), reverse = True)

    s_len = len(s)
    t_len = len(t)

    gt = s_len < t_len

    for i in range(len(s_bytes)):
        if t_len <= i:
            gt = False
            break
        if s_bytes[i] == t_bytes[i]:
            continue
        gt = s_bytes[i] < t_bytes[i]
        break

    print('Yes' if gt else 'No')


if __name__ == '__main__':
    main()

Solution (Python):
def abc082_b():
    s = sorted(input())
    t = sorted(input(), reverse=True)

    for i in range(min(len(s), len(t))):
        if ord(s[i]) < ord(t[i]):
            print("Yes")
            return 0

    if len(s) < len(t):
        for c in s:
            if c in t:
                t.remove(c)
            else:
                print("No")
                return 0
        print("Yes")
        return 0

    print("No")


abc082_b()

Solution (Python):
s = input()
t = input()
s_list = list(s)
t_list = list(t)
s_list.sort()
t_list.sort(reverse = True)

if s_list < t_list:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input().strip()
t = input().strip()

s = ''.join(sorted(s))
t = ''.join(sorted(t)[::-1])

if s < t:
  print('Yes')
else:
  print('No')

Solution (Python):
print("Yes" if sorted(input()) < sorted(input())[::-1] else "No");

Solution (Python):
def main():
    s = ''.join(sorted(input()))
    t = ''.join(sorted(input(), reverse=True))
    if s < t:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Solution (Python):
s = sorted(input())
t = sorted(input(), reverse=True)
if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
if __name__ == '__main__':
    s = input()
    t = input()

    s_1 = "".join(sorted(s))
    t_1 = "".join(reversed(sorted(t)))

    if s_1 < t_1:
        print("Yes")
    else:
        print("No")

Solution (Python):
s = input()
t = input()

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

Solution (Python):
s = list(input())
t = list(input())

s2 = ''.join(sorted(s))
t2 = ''.join(sorted(t,reverse=True))
if (s2 < t2) :
    print("Yes")
else :
    print("No")

Solution (Python):

s = list(raw_input())
t = list(raw_input())
s1 = sorted(s)
t1 = sorted(t,reverse=True)
if s1<t1:
  print 'Yes'
else:
  print 'No'

Solution (Python):
s=input()
t=input()

s_as=''.join(sorted(s))
t_as=''.join(sorted(t,reverse=True))

if(s_as<t_as):
    print("Yes")
else:
    print("No")

Solution (Python):

s = ''.join(sorted(input()))
t = ''.join(sorted(input(), reverse=True))
if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
s=input()
t=input()
S=sorted(s)
T=sorted(t,reverse=True)
if S<T:
    print('Yes')
else:print('No')

Solution (Python):





def compalTwoString(orgs,orgt):

	minStringS = ''.join(sorted(orgs,reverse=False))
	maxStringT = ''.join(sorted(orgt,reverse=True))
	if minStringS < maxStringT :
		answer= "Yes"
	else:
		answer= "No"
	return answer


if __name__ == '__main__':
	stringS=input()
	stringT=input()
	check=compalTwoString(stringS,stringT)
	print(check)

Solution (Python):
s=input()
t=input()
S=sorted(s)
T=sorted(t,reverse=True)
if S<T:
    print('Yes')
else:print('No')

Solution (Python):
s = input().rstrip()
t = input().rstrip()
s = sorted(s)
t = sorted(t, reverse=True)
if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
X = input()
Y = input()
X = [c for c in X]
Y = [c for c in Y]
X.sort()
Y.sort()
Y.reverse()
if ''.join(X) < ''.join(Y):
  print("Yes")
else:
  print("No")

Solution (Python):
s=input()
t=input()
s = list("".join(list(s)))
t = list("".join(list(t)))
s=sorted(s)
t=sorted(t,reverse=True)


if t > s:
    print("Yes")
else:
    print("No")

Solution (Python):


if __name__ == "__main__":
    s = list(str(input()))
    t = list(str(input()))

    s.sort()
    s = "".join(s)
    t.sort(reverse=True)
    t = "".join(t)

    if t > s:
        print("Yes")
    else:
        print("No")

Solution (Python):
s=''.join(sorted(input()))
t=''.join(sorted(input(),reverse=True))
if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
s = ''.join(sorted(input()))
t = ''.join(sorted(input())[::-1])
if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
a = sorted(input())
b = sorted(input(),reverse=True)
ar = ["".join(a),"".join(b)]
br = sorted(ar)
if a == b:
    print("No")
else:
    if ar == br:
        print("Yes")
    else:
        print("No")

Solution (Python):
s = input()
t = input()
_s = ''.join(sorted(s))
_t = ''.join(list(reversed(sorted(t))))
if _s < _t:
    print('Yes')
else:
    print('No')

Solution (Python):

def str_sort(x, s = False):
    y = sorted(x, reverse = s)
    return ''.join(y)

s = input()
t = input()

s = str_sort(s)
t = str_sort(t, True)

if s < t:
    print("Yes")
else:
    print("No")

Solution (Python):
s = raw_input()
t = raw_input()

sd = "".join(sorted(list(s)))
td = "".join(sorted(list(t), reverse=True))
if sd < td:
	print "Yes"
else:
	print "No"

Solution (Python):
s = input()
t = input()

sList = ["" for i in range(len(s))]
tList = ["" for i in range(len(t))]
for i in range(len(s)):
    sList[i] = (ord(s[i])-ord("a"))
for i in range(len(t)):
    tList[i] = (ord(t[i])-ord("a"))
sList = sorted(sList)
tList = sorted(tList)[::-1]

for i in range(min(len(sList), len(tList))):
    if sList[i] < tList[i]:
        print("Yes")
        exit()
    elif sList[i] > tList[i]:
        print("No")
        exit()
if len(sList) < len(tList):
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
t = input()

print("Yes" if sorted(s) < sorted(t)[::-1] else "No")

Solution (Python):
s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)

for i in range(min(len(s), len(t))):
    if s[i] < t[i]:
        print('Yes')
        break
    elif s[i] > t[i]:
        print('No')
        break
    if i == min(len(s), len(t)) - 1:
        if len(s) == len(t):
            print('No')
        elif min(len(s), len(t)) == len(s):
            print('Yes')
        else:
            print('No')

Solution (Python):
def sorted_str(s):
    return "".join(sorted([c for c in s]))

s = input()
t = input()

if sorted_str(s) < sorted_str(t)[::-1]:
    print("Yes")
else:
    print("No")

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
if s < t:
  print('Yes')
else:
  print('No')

Solution (Python):
S = input()
T = input()
S = sorted(S)
T = sorted(T, reverse = True)
if S < T:
    print("Yes")
else:
    print("No")

Solution (Python):
s = sorted([c for c in input()])
t = sorted([c for c in input()], reverse=True)
if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
s = list(input())
t = list(input())
def judge(l1,l2): 
    for e in l1:
        if e not in l2:
            return False
            break
        elif e  == l1[-1]:
            return True
if len(s) < len(t) and judge(s,t):
    print("Yes")
else:
    s_ord = [ord(e) for e in s]
    t_ord = [ord(e) for e in t]
    s_ord.sort()
    t_ord.sort()
    t_ord.reverse()
    for i in range(min(len(t_ord),len(s_ord))):
        if t_ord[i] > s_ord[i]:
            print("Yes")
            break
        elif i == min(len(t_ord),len(s_ord)) - 1:
            print("No")

Solution (Python):
s = input()
t = input()
s = list(s)
t = list(t)
s.sort()
t.sort(reverse=True)

for i in range(min(len(s), len(t))):
    if s[i] < t[i]:
        print("Yes")
        exit()
    elif s[i] > t[i]:
        print("No")
        exit()

if len(s) < len(t):
    print("Yes")
else:
    print("No")

Solution (Python):
s = list(input())
t = list(input())

s = sorted(s)
t = sorted(t,reverse=True)

if s < t:
  print("Yes")
else:
  print("No")

Solution (Python):
s, t = [list(input()) for i in range(2)]
s2 = ''
t2 = ''
for i in sorted(s):
  s2 += i
for i in sorted(t, reverse=True):
  t2 += i
print('Yes') if s2<t2 else print('No')

Solution (Python):
s=input()
t=input()
S=list(s)
T=list(t)
S.sort()
T.sort()
T.reverse()
s=str(S)
t=str(T)

if S<T:print("Yes")
else :print("No")

Solution (Python):
import sys
N = list(input())
M = list(input())

N.sort()
M.sort(reverse = True)

if(len(N) < len(M)):
    for i in range(len(N)):
        if(M[i] > N[i]):
            print("Yes")
            sys.exit()
        elif(M[i] == N[i]):
            continue
        else:
            print("No")
            sys.exit()
    print("Yes")

if(len(N) >= len(M)):
    for i in range(len(M)):
        if(M[i] > N[i]):
            print("Yes")
            sys.exit()
        elif(M[i] == N[i]):
            continue
        else:
            print("No")
            sys.exit()
    print("No")

Solution (Python):
s = list(input())
t = list(input())
if s==t:
    print("No")
    quit()
s.sort()
t.sort()
t = t[::-1]
v = [s,t]
u = [s,t]
u.sort()
if u == v:
    print("Yes")
else:
    print("No")

Solution (Python):



s = input()
t = input()


s_list = sorted(list(s))
t_list = sorted(list(t), reverse=True)

s_ana = ''.join(s_list)
t_ana = ''.join(t_list)


result = "Yes" if (s_ana < t_ana) else "No"


print(result)

Solution (Python):
import string


S = list(input())
T = list(input())

L = list(string.ascii_lowercase)

S = [L.index(s) for s in S]
T = [L.index(t) for t in T]

S.sort()
T.sort()
T.reverse()

while True:
    if len(S) == 0:
        if len(T) > 0:
            print('Yes')
            break
        else:
            print('No')
            break
    if len(T) == 0:
        print('No')
        break
    s = S[0]
    t = T[0]
    if s < t:
        print('Yes')
        break
    elif s == t:
        del S[0]
        del T[0]
    else:
        print('No')
        break

Solution (Python):
s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)

ss = ''.join(s)
tt = ''.join(t)

print('Yes' if ss < tt else 'No')

Solution (Python):
import sys

s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()

for i in range(min(len(s) , len(t))):
    if ord(s[i]) < ord(t[i]):
        print("Yes")
        sys.exit()
    elif ord(s[i]) > ord(t[i]):
        print("No")
        sys.exit()

print("Yes") if len(s) < len(t) else print("No")

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
ans = [s, t]
ans.sort()
if s == t:
    print("No")
elif ans[0] == s:
    print("Yes")
else:
    print("No")

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
t = input()

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

if s < t:
  print('Yes')
else:
  print('No')

Solution (Python):
s = input()
t = input()

S = sorted(s)
T = sorted(t, reverse=True)

print("Yes"if S<T else "No")

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
print("YNeos"[s >= t::2])

Solution (Python):
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)

if s < t:
    print("Yes")
else:
    print("No")

Solution (Python):
from sys import stdin


def main() -> None:
    s, t = [next_str() for _ in range(2)]
    print("Yes" if sorted(s) < (sorted(t, reverse=True)) else "No")


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Solution (Python):


s=input()
t=input()
res='No'

sl = list(s)
tl = list(t)

sl.sort()
tl.sort(reverse=True)

if sl < tl:
  res='Yes'
print(res)

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

if s < t: print('Yes')
else: print('No')

Solution (Python):
s = input()
t = input()
s_sorted = ''.join(sorted(s))
t_sorted = ''.join(sorted(t, reverse = True))

if s_sorted < t_sorted:
	print('Yes')
else:
	print('No')

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()

ans = 'No'
n_con = min(len(s), len(t))
for i in range(n_con):
	if s[i] != t[i]:
		com_list = [s[i], t[i]]
		com_list.sort()
		if com_list[0] == s[i]:
			ans = 'Yes'
			break
if s[:n_con] == t[:n_con] and len(s) < len(t):
	ans = 'Yes'
print(ans)

Solution (Python):
s=input()
t=input()
s=list(s)
t=list(t)
s.sort()
t.sort(reverse=True)
s=''.join(s)
t=''.join(t)
if s==t:
    print('No')
    exit()
a=[s,t]
a.sort()
if a[0]==s:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
t = input()
S = list(s)
S.sort()
T = list(t)
T.sort(reverse=True)
if ''.join(S) < ''.join(T):
    print("Yes")
else:
    print("No")

Solution (Python):
s = list(input())
t = list(input())

s = sorted(s)
S = "".join(s)

t = sorted(t)
t = t[::-1]
T = "".join(t)

L = [S, T]


LL = sorted(L)
if S == T:
	print("No")
else:
	if LL[0] == S:
		print("Yes")
	else:
		print("No")

Solution (Python):
s = ''.join(sorted(list(input())))
t = ''.join(list(reversed(sorted(list(input())))))

a = [s, t]

if a != sorted(a) or s == t:
    print('No')
else:
    print('Yes')

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

Solution (Python):
print("YNeos"[sorted(input()) >= sorted(input(), reverse = True)::2])

Solution (Python):
a=str(input())
b=str(input())
A=[]
B=[]
for i in a:
   A.append(i)
   A=sorted(A)
for h in b:
   B.append(h)
   B.sort(reverse=True)

if A<B:
    print("Yes")
else:
    print("No")

Solution (Python):
S = list(input())
T = list(input())
S = sorted(S)
T = sorted(T,reverse = True)
counter = 0
l = min(len(S), len(T))
for i in range(l) :
    if S[i] > T[i] :
        print("No")
        break
    elif S[i] < T[i] :
        print("Yes")
        break
    else :
        counter += 1
    if counter == l :
        if len(S) >= len(T) :
            print("No")
            break
        else :
            print("Yes")
            break

Solution (Python):
s = input()
t = input()

S = sorted([x for x in s])
T = sorted([x for x in t])[::-1]
s = "".join(S)
t = "".join(T)
if s == t:
    print("No")
    exit(0)

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

Solution (Python):



def main():
    s = sorted(input())
    t = sorted(input(), reverse=True)

    if s < t:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Solution (Python):
s=list(input())
t=list(input())

s.sort()
t.sort()
t.reverse()

if s<t:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
t = input()

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

print('Yes' if s2 < t2 else 'No')

Solution (Python):
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

s = lc()
t = lc()

s.sort()
t.sort(reverse=True)

if "".join(s) < "".join(t):
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
t = input()

if ''.join(sorted(s)) < ''.join(sorted(t,reverse=True)):
    print('Yes')
else:
    print('No')

Solution (Python):
s = sorted(input())
t = sorted(input())[::-1]

if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
s = sorted(input())
t = sorted(input(), reverse = True)

print ('Yes' if t > s else 'No')

Solution (Python):
s = sorted(input())
t = sorted(input(), reverse = True)

st = sorted([s, t])

if s == t and len(set(s)) == 1 and len(set(t)) == 1:
    print('No')
else:
    if st[0] == s:
        print('Yes')
    else:
        print('No')

Solution (Python):
s = sorted(input())
t = sorted(input(), reverse=True)
len_s = len(s)
len_t = len(t)
n_passed = 0

min_len = min(len_s, len_t)
for i in range(min_len):
    if s[i] < t[i]:
        print("Yes")
        exit()

if len_s < len_t:
    t = sorted(t)
    for i in range(len_s):
        if s[i] == t[i]:
            n_passed += 1
    if n_passed == len_s:
        print("Yes")
        exit()
        
print("No")

Solution (Python):
s = [i for i in input()]
t = [j for j in input()]

a = "".join(sorted(s))
b = "".join(reversed(sorted(t)))

if a < b:
  print("Yes")
else:
  print("No")

Solution (Python):
s, t = [input() for _ in range(2)]

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

Solution (Python):
s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)

if s < t:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()
t=input()
S=[]
T=[]
for i in range (len(s)):
    S.append(s[i])
for i in range (len(t)):
    T.append(t[i])
S.sort()
T.sort(reverse=True)
count=0
for i in range(min(len(s),len(t))):
    if S[i]<T[i]:
        print("Yes")
        count=1
        break
    if S[i]>T[i]:
        print("No")
        count=1
        break
if count==0:
    if len(s)<len(t):
        print("Yes") 
    else:
        print("No")

Solution (Python):
s=input()
t=input()

s_arr=[]
t_arr=[]
for x in s:
    s_arr.append(ord(x)-ord('a'))
for x in t:
    t_arr.append(ord(x)-ord('a'))
s_arr=sorted(s_arr)
t_arr=sorted(t_arr)
t_arr.reverse()
if len(s_arr)>len(t_arr):
    t_arr+=[-1]*(len(s_arr)-len(t_arr))
elif len(s_arr)<len(t_arr):
    s_arr+=[-1]*(len(t_arr)-len(s_arr))
ans='No'
for i in range(len(s_arr)):
    if s_arr[i]<t_arr[i]:
        ans='Yes'
        break
    elif s_arr[i]>t_arr[i]:
        ans='No'
        break
    else:
        pass
print(ans)

Solution (Python):
S = input()
T = input()

S = sorted(S)
tmp = ['','']
for s in S:
    tmp[0] += s
T = sorted(T)
for t in T[::-1]:
    tmp[1] += t
if tmp[0] == tmp[1]:
    print('No')
    exit()
tmp2 = sorted(tmp)
if tmp2[0] == tmp[0]:
    print('Yes')
else:
    print('No')

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
print("Yes") if s < t else print("No")

Solution (Python):
s = input()
t = input()

s_list = sorted(s)
t_list = sorted(t, reverse=True)

s_str = ""
t_str = ""
for c in s_list:
	s_str += c
for c in t_list:
	t_str += c

if s_str < t_str:
	print("Yes")
else:
	print("No")

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
print("Yes" if "".join(s) < "".join(t) else "No")

Solution (Python):
s = sorted(input())
t = sorted(input(), reverse = True)
if len(s) >= len(t):
  lenth = len(t)
else:
  lenth = len(s)
count = 0
while (s[count] == t[count]) and (lenth - 1 > count):
  count += 1
if s[count] == t[count]:
  if len(s) < len(t):
    print("Yes")
  else:
    print("No")
else:
  if s[count] < t[count]:
    print("Yes")
  else:
    print("No")

Solution (Python):
s = list(input())
t = list(input())

s.sort()
t.sort(reverse = True)

if s < t:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
t = input()
s_list = list(s)
t_list = list(t)
s_list.sort()
t_list.sort()
t_list.reverse()
if s_list < t_list:
    print('Yes')
else:
    print('No')

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
print("Yes" if s < t else "No")

Solution (Python):
listS=list(input())
listT=list(input())
alphaL =  [chr(i) for i in range(97,97+26)]
listS.sort()
listT.sort()
listT.reverse()

if alphaL.index(listS[0]) < alphaL.index(listT[0]):
    print("Yes")
else:
    if len(listS) < len(listT):
        listS.reverse()
        index=0
        while index < len(listS):
            if listS[index]!=listT[index]:
                print("No")
                break
            else:
                index+=1
        if index == len(listS):
            print("Yes")
    else:
        print("No")

Solution (Python):
ss = list(input())
tt = list(input())
ss.sort()
tt.sort()
tt.reverse()
print('Yes' if ss < tt else 'No')

Solution (Python):
s = str(input())
t = str(input())
s_list = list(s)
t_list = list(t)
s_list.sort()
t_list.sort()
t_list = t_list[::-1]
count = 0
while count < max(len(s_list), len(t_list)):
    if s_list[count] > t_list[count]:
        print("No")
        break
    if s_list[count] < t_list[count]:
        print("Yes")
        break
    if s_list[count] == t_list[count]:
        if count + 1 == min(len(s_list), len(t_list)):
            if len(s_list) >= len(t_list):
                print("No")
                break
            else:
                print("Yes")
                break
        else:
            count += 1
            continue
        break

Solution (Python):
s = input()
t = input()

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

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse() 
s=''.join(s)
t=''.join(t)
if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
s = list(input())
t = list(input())
n = len(s)
m = len(t)
s.sort()
t.sort()
t = t[-1::-1]
a = b = ""
for i in range(n):
    a += s[i]
for i in range(m):
    b += t[i]
if a < b:
    print("Yes")
else:
    print("No")

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse = True)
if ''.join(s) < ''.join(t) :
  print('Yes')
else:
  print('No')