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(input())
t = sorted(input(),reverse=True)
ans = ""
def check_dict():
  for i in range(min(len(s),len(t))):
    if s[i] < t[i]:
      ans = "Yes"
      return ans
    elif s[i] > t[i]:
      ans = "No"
      return ans
  return ""
if len(s) < len(t):
  ans = check_dict()
  if ans == "":
    ans = "Yes"
  print(ans)
else:
  ans = check_dict()
  if ans == "":
    ans = "No"
  print(ans)

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

s = sorted(s)
t = sorted(t)


if s[0] < t[-1]:
    print('Yes')
    exit()
elif s[0] > t[-1]:
    print('No')
    exit()
elif len(set(s)) ==1 and len(set(t)) ==1 and len(s) < len(t):
    print('Yes')
    exit()
else:
    print('No')

Solution (Python):
s = str(input())
t = str(input())
S = []
T = []

for i in s:
    S.append(i)
for j in t:
    T.append(j)

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

S = ''.join(S)
T = ''.join(T)

if S < T:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

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

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

st = [ss,tt]
sst = [ss, tt]
sst.sort()

if ss == tt:
    print("No")
elif st == sst:
    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 = input()
t = input()

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

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

Solution (Python):
a = "".join(sorted(input()))
b = "".join(sorted(input())[::-1])
print("Yes" if a < b else "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):
if sorted(input()) < sorted(input())[::-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()
ss="".join(sorted(s))
tt="".join(sorted(t,reverse=True))
if ss<tt:
    print("Yes")
else:
    print("No")

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

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

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

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

s = "".join(s)
t = "".join(t)

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

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

ls_s_1st = sorted(list(s))
ls_t_last = list(reversed(sorted(list(t))))

ls_org = ["".join(ls_s_1st), "".join(ls_t_last)]

ls_sort = sorted(ls_org)

if ls_org[0] == ls_sort[0] and ls_org[1] == ls_sort[1] and s != t:
    print("Yes")
else:
    print("No")

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

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

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

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

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

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

Solution (Python):
s,t = open(0).read().split()
s = "".join(sorted(s))
t = "".join(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)

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


for i in range(min(len(s), len(t))):
    if ord(s[i]) < ord(t[i]):
        ans = 'Yes'
        break

    elif ord(s[i]) > ord(t[i]):
        ans = 'No'
        break

    else:
        if i == min(len(s), len(t))-1:
            ans = f1

print(ans)

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

Solution (Python):
s = input()
s＿asc = "".join(sorted(s))

t = input()
t_dasc = "".join(sorted(t, reverse=True))

if s_asc < t_dasc:
  print("Yes")
else:
    print("No")

Solution (Python):

import sys

YES = "Yes"  
NO = "No"  


def solve(s: str, t: str):
    s = list(s)
    t = list(t)
    s.sort()
    t.sort(reverse= True)
    s = ''.join(s)
    t = ''.join(t)
    if s<t:
        print(YES)
    else:
        print(NO)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  
    t = next(tokens)  
    solve(s, t)

if __name__ == '__main__':
    main()

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

Solution (Python):
s = input()
t = input()
s1 = sorted(s)
t1 = sorted(t)
t1.reverse()
if s1 < t1:
    print("Yes")
else:
    print("No")

Solution (Python):
a = input()
b = input()

print("Yes" if sorted(a) < sorted(b)[::-1] else "No")

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

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

if s_min < t_max:
    print('Yes')
else:
    print('No')

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

Solution (Python):
s=sorted(input())
t=sorted(input(),reverse=True)
s1=""
for i in s:
  s1+=i
t1=""
for i in t:
  t1+=i

arr=[s1,t1]
arr2=sorted(arr)
if arr==arr2:
  if s==t:
    print('No')
  else:
    print('Yes')
else:
  print('No')

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

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

s = "".join(s)
t = "".join(t)

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

Solution (Python):

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

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

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

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

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

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

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

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

Solution (Python):


s=input()
t=input()

sp="".join(sorted(s)) 
tp="".join(list(reversed(sorted(t)))) 

if sp<tp: 
    print("Yes")
else: 
    print("No")

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

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

Solution (Python):
def main():
    s = input()
    s_list = list(s)
    s_list.sort()

    t = input()
    t_list = list(t)
    t_list.sort(reverse = True)

    for i in range(0,min(len(s_list),len(t_list))):
        if s_list[i] < t_list[i]:
            print("Yes")
            return
        elif s_list[i] > t_list[i]:
            print("No")
            return

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

    return

if __name__ == "__main__":
    main()

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

if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
N = input()
M = input()

sorted_asc = sorted(list(N))
sorted_desc = sorted(list(M), reverse=True)
res = ""

for (x, y) in zip(sorted_asc, sorted_desc):
    if x < y:
        res = "Yes"
        break
    elif x > y:
        res = "No"
        break

if res == "":
    if len(N) >= len(M):
        res = "No"
    else:
        res = "Yes"

print(res)

Solution (Python):
N = input()
M = input()

sorted_asc = sorted(list(N))
sorted_desc = sorted(list(M), reverse=True)
res = ""

for (x, y) in zip(sorted_asc, sorted_desc):
    if x < y:
        res = "Yes"
        break
    elif x > y:
        res = "No"
        break

if res == "" and len(N) == len(M):
    res = "No"
elif res == "" and len(N) < len(M):
    res = "Yes"
elif res == "" and len(N) > len(M):
    res = "No"

print(res)

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

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

Solution (Python):
s=[i for i in input()]
t=[i for i in input()]
if s==t:
  print('No')
else:
  s=sorted(s)
  t=sorted(t,reverse=True)
  s=''.join(s)
  t=''.join(t)
  l=[s,t]
  l2=sorted(l)
  if l==l2:
    print('Yes')
  else:
    print('No')

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

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

if s_asc < t_desc:
    ans = "Yes"
else:
    ans = "No"

print(ans)

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

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

Solution (Python):
s = input()
a=sorted(s)
t = input()
b=sorted(t)
b.reverse()
if a<b:
	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):
from collections import Counter
s = input()
t = input()
S = Counter(s)
T = Counter(t)
li_s = sorted(list(s))
li_t = sorted(list(t),reverse=True)
ans_s = ''.join(li_s)
ans_t = ''.join(li_t)
if ans_s < ans_t:
    print('Yes')
else:
    print('No')

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

Solution (Python):

s = input()
s_asc = ''.join(sorted(s))

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

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

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

Solution (Python):
s = input()
s_asc = ''.join(sorted(s))

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

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

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

Solution (Python):
s = input()
t = input()
s = "".join(sorted(list(s)))
t = "".join(sorted(list(t),reverse=True))
import string
letter = list(string.ascii_lowercase)
for i in range(min(len(s), len(t))) :
    if letter.index(s[i]) == letter.index(t[i]) :
        continue
    elif letter.index(s[i]) < letter.index(t[i]) :
        ans = "Yes"
        break
    elif letter.index(s[i]) > letter.index(t[i]) :
        ans = "No"
        break
else :
    if len(s) < len(t) :
        ans = "Yes"
    elif len(s) >= len(t) :
        ans = "No"
print(ans)

Solution (Python):

s = list(str(input()))
t = list(str(input()))
s.sort(reverse=False)
t.sort(reverse=True)
s = ''.join(s)
t = ''.join(t)

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

Solution (Python):
A=list(input())
B=list(input())
a = sorted(A)
b = sorted(B, reverse = True)
if a < b:
  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)
l = [s,t]
l.sort()

if l[0] == s and l[1] != s:
    print("Yes")
else:
    print("No")

Solution (Python):
def examB():
    St = S(); T = S()
    s_asc = ''.join(sorted(St))
    t_desc = ''.join(sorted(T, reverse=True))
    if s_asc < t_desc:
        print('Yes')
    else:
        print('No')


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

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

Solution (Python):
s=input()
t=input()
sn=sorted(s)
tn=sorted(t,reverse=True)
l=[sn,tn]
l.sort()
print('Yes' if l[0]==sn and l[1]!=sn else 'No')

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

sorted_s = sorted(s)
sorted_t = sorted(t, reverse=True)
len_s = len(sorted_s)
len_t = len(sorted_t)
iter_range = len_s if len_s < len_t else len_t

flag = 0
same_count = 0
for i in range(iter_range):
    s_i = sorted_s[i]
    t_i = sorted_t[i]
    if s_i < t_i:
        flag = 1
        break
    if s_i == t_i:
        same_count+= 1

if (same_count == len_s) & (len_s < len_t):
    print("Yes")
elif (same_count == len_s) & (len_s >= len_t):
    print("No")
elif flag:
    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=list(str(input()))
t=list(str(input()))
s=sorted(s)
t=sorted(t,reverse=True)
judge=0

for i,j in zip(s,t):
    if ord(i)>ord(j):
        judge=0
        break
        
    elif ord(i)<ord(j):
        judge=1
        break
        
    else:
        judge=2
        continue
    
if judge==2:
    if len(s)>=len(t):
        judge=0
    else:
        judge=1

if judge==1:print('Yes')
else:print('No')

Solution (Python):
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
s1=''
t1=''
for j in range(len(s)):
    s1+=s[j]
for k in range(len(t)):
    t1+=t[k]
if s1==t1:
    print('No')
else:
    for i in range(min(len(s),len(t))):
        if s[i]>t[i]:
            print('No')
            break
        elif s[i]==t[i]:
            if i==min(len(s),len(t))-1:
                if len(s)==min(len(s),len(t)):
                    print('Yes')
                else:
                    print('No')
            continue
        else:
            print('Yes')
            break

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    def sort_for(s):
        cc = [c for c in s]
        cc.sort()
        s = "".join(cc)
        return s

    def sort_rev(t):
        cc = [c for c in t]
        cc.sort(reverse=True)
        t = "".join(cc)
        return t

    s = input()
    t = input()
    s = sort_for(s)
    t = sort_rev(t)
    st = [s, t]
    st.sort()
    if st[0] == s and s != t:
        print("Yes")
    else:
        print("No")

main()

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

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

Solution (Python):

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

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

print('Yes' if  ''.join(s) < ''.join(t) else '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):
from sys import stdin


s = stdin.readline().rstrip()
s = [str(i) for i in s]

t = stdin.readline().rstrip()
t = [str(i) for i in t]

if s == t:
    print("No")
    exit()
s.sort()
t.sort(reverse=True)

ns = ""
nt = ""

for i in range(len(s)):
    ns += s[i]

for i in range(len(t)):
    nt += t[i]

li = [ns,nt]

lin = sorted(li)


if lin == li:
    print("Yes")
    exit()
print("No")

Solution (Python):
import sys

def main():
  s = list(input())
  t = list(input())
  
  s.sort()
  t.sort()
  t.reverse()
  m = min(len(s), len(t))
  for i in range(m):
    if s[i] > t[i]:
      print('No')
      sys.exit()
    elif s[i] < t[i]:
      print('Yes')
      sys.exit()

  if len(s) < len(t):
    print('Yes')
    sys.exit()
  else:
    print('No')
    sys.exit()
    
main()

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()
ls,lt=[],[]
for cs in s:
    ls.append(cs)
for ct in t:
    lt.append(ct)
ls.sort()
lt.sort(reverse=True)
s="".join(ls)
t="".join(lt)
if s<t: 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())
s.sort()
t.sort(reverse=True)
ss = "".join(s)
tt = "".join(t)
if ss < tt:
    print("Yes")
else:
    print("No")

Solution (Python):
s = "".join(sorted(input()))
t = "".join(sorted(input())[::-1])
if s==t or [s, t] != sorted([s, t]):
  print("No")
else:
  print("Yes")

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()
a=[s[i] for i in range(len(s))]
b=[t[i] for i in range(len(t))]
a.sort()
b.sort(reverse=True)
s=""
t=""
for i in a:
    s+=i
for i in b:
    t+=i
if s<t:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

a=list(input())
b=list(input())
a.sort()
b.sort(reverse=True)
n=len(a)
m=len(b)

for i in range(min(n,m)):
    if a[i]>b[i]:
        print("No")
        sys.exit()
    elif a[i]<b[i]:
        print("Yes")
        sys.exit()
if n>=m:
    print("No")
else:
    print("Yes")

Solution (Python):
s=input()
t=input()
s2 = sorted(s)
t2 = sorted(t,reverse=True)
if s2<t2:
  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):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s = list(input())
t = list(input())
s.sort()
t.sort(reverse = True)
for i in range(len(s)):
    if i >= len(t):
        break
    if s[i] > t[i]:
        print('No')
        quit()
    elif s[i] < t[i]:
        print('Yes')
        quit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')

Solution (Python):
s=input();t=input()
ls=sorted([c for c in s]);lt=sorted([c for c in t],reverse=True)
s2=''.join(ls);t2=''.join(lt)
print('Yes' if s2<t2 else 'No')

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=1)
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):
s=input()
t=input()
s=sorted(s)
t=sorted(t,reverse=True)
S=""
for x in s:
  S+= x
T=""
for x in t:
  T+= x
A=[S,T]
a=sorted(A)
if a[0]==S:
  if a[1]==S:
    print("No")
  else:
    print("Yes")
else:
  print("No")

Solution (Python):
s=input()
t=input()
a=[]
b=[]
for i in range(len(s)):
    a.append(s[i])
    a.sort()
for i in range(len(t)):
    b.append(t[i])
    b.sort(reverse=True)
c=[a,b]
c.sort()
if c[0]==a and a!=b:
    print("Yes")
else:
    print("No")

Solution (Python):
s=sorted(list(input()))
t=sorted(list(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 = str(input())
t = str(input())
s_a=''.join(sorted(s))
t_z=''.join(reversed(sorted(t)))
if s_a < t_z:
  print('Yes')
else:
  print('No')

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

Solution (Python):
import sys








def main():
    s, t = sys.stdin.read().split()
    n, m = len(s), len(t)
    s = sorted(s)
    t = list(reversed(sorted(t)))
    if n < m:
        for i in range(n):
            if s[i] < t[i]: ans = 'Yes'; break
            elif s[i] > t[i]: ans = 'No'; break  
        else:
            ans = 'Yes'
    else:
        for i in range(m):
            if s[i] < t[i]: ans = 'Yes'; break
            elif s[i] > t[i]: ans = 'No'; break  
        else:
            ans = 'No'

    print(ans)
        

if __name__ == "__main__":
    
    main()

Solution (Python):
import sys


import string





def main():
    s, t = sys.stdin.read().split()
    n, m = len(s), len(t)
    s = sorted(s)
    t = list(reversed(sorted(t)))
    if n < m:
        for i in range(n):
            f_s, f_t = False, False
            for c in string.ascii_lowercase:
                if s[i] == c: f_s = True
                if t[i] == c: f_t = True
                
                if f_s and not f_t: print('Yes'); exit()
                elif not f_s and f_t: print('No'); exit()
                elif f_s and f_t: break
                else: continue
        ans = 'Yes'
    else:
        for i in range(m):
            for c in string.ascii_lowercase:
                f_s, f_t = False, False
                if s[i] == c: f_s = True
                if t[i] == c: f_t = True
                
                if f_s and not f_t: print('Yes'); exit()
                elif not f_s and f_t: print('No'); exit()
                elif f_s and f_t: break
                else: continue
        ans = 'No'

    print(ans)
        

if __name__ == "__main__":
    
    main()

Solution (Python):
s,t=[[i for i in input()] for _ in range(2)]
s.sort()
t.sort()
st=""
ts=""
for i in range(len(s)):
    st+=s[i]
for i in range(len(t)):
    ts+=t[len(t)-i-1]
print("Yes" if st<ts else "No")

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

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

Solution (Python):
S, T = [s for s in input()], [s for s in input()]
s_str = ''.join(sorted(S))
t_str = ''.join(sorted(T, reverse=True))
if s_str == t_str:
  print('No')
  exit()
else:
  print('Yes' if sorted([s_str,t_str]).index(s_str)==0 else 'No')

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

Solution (Python):
s = list(input())
s.sort()
t = list(input())
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 = sorted(input())
t = sorted(input())[::-1]
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):
s = sorted(input())
t = sorted(input(), reverse=True)
print("Yes" if s<t else "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):
a = input()
b = input()

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

ans = "No"
for aa in a:
    for bb in b:
        if aa < bb:
            ans = "Yes"
            break
print(ans)

Solution (Python):
s = input()
s_asc = ''.join(sorted(s))

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

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

Solution (Python):
s = input()
t = input()
tmp1 = "".join(sorted(list(s)))
tmp2 = "".join(sorted(list(t),reverse = 1))
if tmp1 < tmp2:
    print("Yes")
else:
    print("No")

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

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

if s_sort < t_sort:
    print("Yes")
else:
    print("No")

Solution (Python):
n = sorted([i for i in input()])
m = sorted([i for i in input()],reverse = True)

flg = True
if ''.join(n) >= ''.join(m):
    flg = False

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

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

s=sorted(s)
l=list(reversed(sorted(l)))



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

Solution (Python):
S = sorted(list(map(str, input())))
T = sorted(list(map(str, input())), reverse = True)
length = min(len(S), len(T))

flg = 2

for i in range(length):
	if S[i] < T[i]:
		flg = 1
		break
	elif S[i] > T[i]:
		flg = 0
		break

if flg == 1:		
	print("Yes")
elif flg == 0:
	print("No")
else:
	if len(S) < len(T):
		print("Yes")
	else:
		print("No")

Solution (Python):
s=sorted(input())
t=sorted(input())[::-1]
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 S < T:
    print('Yes')
else:
    print('No')

Solution (Python):
def is_b_larger_than_a(a, b):
  n = min(len(a), len(b))
  for i in range(n):
    if ord(a[i]) > ord(b[i]):
      return False
    if ord(a[i]) < ord(b[i]):
      return True
  return len(a) < len(b)

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

if is_b_larger_than_a(s, t):
  print("Yes")
else:
  print("No")

Solution (Python):
"""
author : halo2halo
date : 25,Oct,2019
"""

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

a = readline().rstrip()
b = readline().rstrip()

print("Yes" if ''.join(sorted(a)) < ''.join(sorted(b)[::-1]) else "No")

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

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

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

S=[]
for i in range(len(s)):
    S.append(str(s[i]))
S.sort()
s=''.join(S)

T=[]
for i in range(len(t)):
    T.append(str(t[i]))
T.sort(reverse=True)
t=''.join(T)

if s==t:
    print('No')
else:
    print(['Yes','No'][sorted([s,t]).index(s)])

Solution (Python):



import unittest
from io import StringIO
import sys


def input():
    return sys.stdin.readline().rstrip()


def resolve():
    s = list(input())
    t = list(input())

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

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


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """yx
axy"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """ratcode
atlas"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """cd
abc"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """w
ww"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_5(self):
        input = """zzz
zzz"""
        output = """No"""
        self.assertIO(input, output)


if __name__ == "__main__":
    
    resolve()

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

Solution (Python):
x = sorted(input())
y = sorted(input(), reverse=True)

print('Yes' if x < y else '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=input()
t=input()
sl=list(s)
tl=list(t)
sl.sort()
tl.sort(reverse=True)
s=''.join(sl)
t=''.join(tl)
if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
w="".join(s)
v="".join(t)
ans=[w,v]
ans.sort()
print("Yes" if (ans[0]==w and w!=v) else "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(),reverse = True)
print('Yes' if s < t else 'No')

Solution (Python):
s=input()
t=input()
S=[]
for i in s:
    S.append(i)
S.sort()
T=[]
for i in t:
    T.append(i)
T.sort(reverse=True)
if S<T:
    print("Yes")
else:
    print("No")

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

s.sort()
s=''.join(s)

t.sort()
t.reverse()
t=''.join(t)

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

Solution (Python):
s = [c for c in input()]
t = [c for c in input()]
s.sort()
t.sort(reverse=True)
ss = ''.join(s)
tt = ''.join(t)
print('YNeos'[ss>=tt::2])

Solution (Python):
s=str(input())
t=str(input())
count=0
for i in range(len(s)):
	for j in range(len(t)):
		if s[i] < t[j]:
			count+=1
if set(s) == set(t):
	if len(s) < len(t):
		count+=1
print('Yes' if count !=0 else '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, t = [input() for _ in range(2)]
print('Yes' if sorted(s) < sorted(t, reverse=True) else 'No')

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

i = 0

while(i < N and i < M):
  if(s[i] < t[i]):
    print("Yes")
    break
  elif(s[i] > t[i]):
    print("No")
    break
  else:
    i += 1

if(N < M and i == N):
  print("Yes")

if(M <= N and M == i):
  print("No")

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

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

Solution (Python):
s=sorted(input())
t=sorted(input(),reverse=1)
if [s,t]==sorted([s,t]) and s!=t:
  print('Yes')
else:
  print('No')

Solution (Python):
s=list(input())
t=list(input())
s2="".join(sorted(s))
t2="".join(sorted(t,reverse=True))
st=sorted([s2,t2])
print("Yes" if  st[0]==s2 and s2!=t2 else "No")