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 = input()
t = input()
s1 = sorted(s)
t1 = sorted(t, reverse=True)
if s1 < t1:
    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 sorted(s) < sorted(t,reverse=True): print("Yes")
else: print("No")

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=sorted(s)
t=sorted(t,reverse=True)
s=''.join(s)
t=''.join(t)
if t>s:
    print('Yes')
else:
    print('No')

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

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

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

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

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

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

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

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=1)
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=sorted(input())
t=sorted(input(),reverse=True)

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

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

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

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

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

Solution (Python):

a = input()
b = input()

aa = list(a)
bb = list(b)

aa.sort()
bb.sort(reverse=True)


S = "".join(aa)
T = "".join(bb)

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

Solution (Python):
s = sorted(input())
t = sorted(input(), reverse=True)
print("Yes" if s<t else "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):
aa = input()
bb = input()

a = list(aa)
b = list(bb)

a.sort()
b.sort()

b = b[::-1]

S="".join(a)
T="".join(b)


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

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

sl = list(s)
sl.sort()
tl = list(t)
tl.sort()
tl=tl[::-1]
S="".join(sl)
T="".join(tl)
if S<T:
    ans ='Yes'
else:
    ans = 'No'
print(ans)

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

Solution (Python):
s = input()
t = input()
l_s = [s[i] for i in range(len(s))]
l_t = [t[i] for i in range(len(t))]
l_s.sort()
l_t.sort(reverse=True)
s_new = ''.join(l_s)
t_new = ''.join(l_t)
if s_new < t_new:
  print('Yes')
else:
  print('No')

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


def read():
    S = input().strip()
    T = input().strip()
    return S, T


def solve(S, T):
    s = ''.join(sorted(S))
    t = ''.join(reversed(sorted(T)))
    return "Yes" if s < t else "No"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

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

if ss < tt:
    print("Yes")
else:
    print("No")

Solution (Python):
s=sorted(input())
t=sorted(input())[::-1]
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
else:
    if len(s)<len(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 =input()
t =input()

ss = sorted(s)
tt = sorted(t)

sl = len(ss)
tl = len(tt)

ttr = list(reversed(tt))

if sl >= tl:
    for i in range(tl):
        if ss[i] < ttr[i]:
            print("Yes")
            exit()
        elif ss[i] > ttr[i]:
            print("No")
            exit()
    print("No")
    exit()
    
elif sl < tl:
    for i in range(sl):
        if ss[i] < ttr[i]:
            print("Yes")
            exit()
        elif ss[i] > ttr [i]:
            print("No")
            exit()
    print("Yes")
    exit()

Solution (Python):
s = list(input())
t = list(input())
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()
if s==t and s.count(s[0])==len(s) and t.count(s[0])==len(t):
    print('No')
elif s.count(s[0])==len(s) and t.count(s[0])==len(t):
    if len(s)<len(t):
      print('Yes')
    else:
      print('No')
else:
    if ord(s[0])==ord(t[-1]):
      print('No')
    elif ord(s[0])<ord(t[-1]):
      print('Yes')
    else:
      print('No')

Solution (Python):
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
l=min(len(s), len(t))
for i in range(l):
  if s[i]==t[i]:
    continue
    
  if s[i]<t[i]:
    print("Yes")
    exit()
  else:
    print("No")
    exit()
if len(s)>=len(t):
  print("No")
else:
  print("Yes")

Solution (Python):
import sys

input = sys.stdin.readline


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

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

    ans = "Yes" if ss < tt else "No"
    print(ans)


if __name__ == "__main__":
    main()

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

Solution (Python):
import collections

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

for i in range(min(len(s), len(t))):
    if ord(s[i]) > ord(t[i]):
        print('No')
        break
    elif ord(s[i]) < ord(t[i]):
        print('Yes')
        break
    else:
        pass
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)
ST = sorted([S, T])
if ST[0] != T:
  print('Yes')
else:
  print('No')

Solution (Python):
s = input()
t = input()
s_ = sorted(s)
t_ = sorted(t, reverse=True)
for n, i in enumerate(zip(s_, t_)):
    if i [0]< i[1]:
        print('Yes')
        break
    elif i[1] < i[0]:
        print('No')
        break
    if n + 1 == min(len(s_), len(t_)):
        if len(s_) < len(t_):
            print('Yes')
            break
        elif len(t_) <= len(s_):
            print('No')
            break

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

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


if sDash < tDash:
  print('Yes')
else:
  print('No')

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

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


def checkAlphabetOrder(a, b):
    temp = [a, b]
    compare = sorted(temp)
    return temp[0] == compare[0]



for i in range(min(len(s), len(t))):
    if sDash[i] == tDash[i]: continue
    elif checkAlphabetOrder(sDash[i], tDash[i]):
        print('Yes')
        break
    else:
        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 = "".join(sorted(list(input())))
t = "".join(sorted(list(input()))[::-1])
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())
frag=""
n=min(len(s),len(t))
for i in range(n):
  if min(s)<max(t):
    frag="Yes"
    break
  elif min(s)>max(t):
    frag="No"
    break
  else:
    s.pop(s.index(min(s)))
    t.pop(t.index(max(t)))
if frag=="":
  if len(t)>0:
    frag="Yes"
  else:
    frag='No'
print(frag)

Solution (Python):
s=input()
t=input()
if s==t:
    print("No")
    exit()

s1=[s[i] for i in range(len(s))]
t1=[t[i] for i in range(len(t))]
s1.sort()
t1.sort(reverse=True)
S="".join(s1)
T="".join(t1)

l=[S,T]
l.sort()
if l[0]==S:
    print("Yes")
else:
    print("No")

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

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

l = [s,t]
l.sort()

if s == t:
    print("No")
elif l[0] == s:
    print("Yes")
else:
    print("No")

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

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

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

Solution (Python):
s = input()
t = input()
ss = ''.join(sorted(list(s)))
st = ''.join(sorted(list(t),reverse=True))
print('YNeos'[ss >= st::2])

Solution (Python):
S = sorted(list(str(input())))
T = sorted(list(str(input())),reverse=True)

print('YNeos'[S>=T::2])

Solution (Python):
S = sorted(list(str(input())))
T = sorted(list(str(input())),reverse=True)

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

Solution (Python):
S = sorted(list(str(input())))
T = sorted(list(str(input())),reverse=True)

for i in range(min(len(S),len(T))):
    if S[i] < T[i]:
        print('Yes')
        break
    elif S[i] == T[i]:
        if i+1 == len(S) < len(T):
            print('Yes')
            break
        elif i+1 == len(T):
            print('No')
            break
        else:
            continue
    else:
        print('No')
        break

Solution (Python):
import sys
s = str(input())
t = str(input())
sl = list(s)
tl = list(t)
sl.sort()
tl.sort()
tl = tl[::-1]
a = "".join(sl)
b = "".join(tl)
if a == b:
    print("No")
    sys.exit()
ls = [a,b]
new = sorted(ls)
if ls[0] == new[0]:
    print("Yes")
else:
    print("No")

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

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

s1 = ''
t1 = ''

for i in s:
    s1 += i

for i in t:
    t1 += i

if s1 < t1:
    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=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
if len(s) < len(t):
  len = len(s)
  flg_s=1
else:
  len = len(t)
  flg_s=0
for i in range(len):
  if ord(s[i]) < ord(t[i]):
    print('Yes')
    exit(0)
  elif ord(s[i]) > ord(t[i]):
    print('No')
    exit(0)
if flg_s == 1:
  print('Yes')
else:
  print('No')

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

Solution (Python):
s = sorted(input())
t = sorted(input(),reverse=True)
flag = -1
i = 0



while(i < min(len(s),len(t))):
  if s[i] > t[i]:
    flag = -1
    break
  elif s[i] < t[i]:
    flag = 1
    break
  else:
    if (i+1 == len(s)) & (len(s) != len(t)):
      flag = 1
      break
    i += 1

if flag == 1: 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):
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction



mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]









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]
print("Yes" if s<t else "No")

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

s.sort()
t.sort(reverse = True)
s1 = ''.join(s)
t1 = ''.join(t)

if s1 < t1:
  print('Yes')
else:
  print('No')

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


for i in range(101):
  if min(s) > max(t):
    print('No')
    exit()
    
  elif min(s) == max(t):
    s.remove(min(s))
    t.remove(max(t))
    if s == [] and t != []:
      print('Yes')
      exit()
    elif s == [] and t == []:
      print('No')
      exit()
    elif s != [] and t == []:
      print('No')
      exit()
  if min(s) < max(t):
    print('Yes')
    exit()

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(list(input()))
t = sorted(list(input()))[::-1]
print("Yes") if s < t else print("No")

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

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

if s1 < t1:
    print('Yes')
else:
    print('No')

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

flag = 0
for elem1, elem2 in zip(s, t):
  if ord(elem1) < ord(elem2):
    print('Yes')
    quit()
  elif ord(elem1) == ord(elem2):
    pass
  else:
    flag = 1
    break
if flag == 1:
  print('No')
else:
  if len(s) < len(t):
    print('Yes')
  else:
    print('No')

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

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

Solution (Python):
s = input()
t = input()
ls = sorted(list(s))
lt = sorted(list(t),reverse=True)
os = [ord(x) for x in ls]
ot = [ord(x) for x in lt]
for i in range(min(len(s),len(t))):
	if os[i] < ot[i]:
		print('Yes')
		break
	elif os[i] > ot[i]:
		print('No')
		break
else:
	if len(s) < len(t):
		print('Yes')
	else:
		print('No')

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

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

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

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

if u<v:
	print('Yes')
else:
	print('No')

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7



s = input()
t = input()

if s < t:
	print("Yes")
	exit()
tmp = sorted(s)[0] 

for x in t: 
	if tmp < x:
		print("Yes")
		break
else:
	print("No")

Solution (Python):
a = sorted(input())
b = sorted(input())[::-1]
print("Yes" if a<b 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 = list(input())
T = list(input())
S.sort()
T.sort(reverse=True)
A = "abcdefghijklmnopqrstuvwxyz"

for a, b in zip(S, T):
    if A.index(a) < A.index(b):
        print("Yes")
        exit()
    elif A.index(b) < A.index(a):
        print("No")
        exit() 

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

Solution (Python):


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    s = input()
    t = input()
    s = ''.join(sorted(list(s)))
    t = ''.join(sorted(list(t), reverse=True))
    print('Yes') if s < t else print('No')


if __name__ == "__main__":
    main()

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

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

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

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

d = [s1, t1]
d = sorted(d)
if s1 == t1:
    print("No")
elif d[0] == s1:
    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)
st = [S, T]
st.sort()

if S == T:
    print("No")
elif st[0] == S:
    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):
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 = ''.join(sorted(list(input())))
t = ''.join(list(reversed(sorted(list(input())))))
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()

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

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

Solution (Python):
s = sorted(input())
t = sorted(input(), reverse = True)
print('No' if s == t else ('No' if s == max(s, t) else '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()

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

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

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 = [i for i in input()]
s.sort()
t = [i for i in input()]
t.sort(reverse=True)
if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7

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

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

S = str()
T = str()

for x in s:
	S += x

for y in t:
	T += y

if sorted([S, T])[0] == S and S != T:
	print("Yes")
else:
	print("No")

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

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

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

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

if (''.join(s_sort) < ''.join(t_sort)):
    print('Yes')
else:
    print('No')

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 ''.join(s) < ''.join(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()
output = "No"
s_sort = sorted(s)
t_sort = sorted(t)
t_sort.reverse()
s_str = "".join(s_sort)
t_str = "".join(t_sort)
if s_str < t_str:
    output = "Yes"

print(output)

Solution (Python):
s = input()
t = input()
output = "No"
s_sort = sorted(s)
t_sort = sorted(t)
t_sort.reverse()
s_str = "".join(s_sort)
t_str = "".join(t_sort)
if s_str < t_str:
    output = "Yes"

print(output)

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=sorted(s)
s="".join(s)
t=sorted(t,reverse=True)
t="".join(t)

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

Solution (Python):
n = input()
m = input()

n = sorted(n)
m = sorted(m, reverse = True)

flag = True

if len(n) < len(m):
    for i in range(len(n)):
        if n[i] == m[i]:
            continue
        else:
            for j in "abcdefghijklmnopqrstuvwxyz":
                if n[i] == j:
                    flag = True
                    break
                if m[i] == j:
                    flag = False
                    break
            break
    else:
        flag = True
elif len(n) == len(m):
    for i in range(len(n)):
        if n[i] == m[i]:
            continue
        else:
            for j in "abcdefghijklmnopqrstuvwxyz":
                if n[i] == j:
                    flag = True
                    break
                if m[i] == j:
                    flag = False
                    break
            break
    else:
        flag = False
else:
    for i in range(len(m)):
        if n[i] == m[i]:
            continue
        else:
            for j in "abcdefghijklmnopqrstuvwxyz":
                if n[i] == j:
                    flag = True
                    break
                if m[i] == j:
                    flag = False
                    break
            break
    else:
        flag = False
        

if flag:
    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):
a="".join(sorted(input()))
b="".join(sorted(input()))[::-1]
if a<b:
    print("Yes")
else:
    print("No")

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

Solution (Python):
s = input()
t = input()
s = sorted(s, reverse=False)
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)

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

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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

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

Solution (Python):
s = input()
t = input()
sl = []
tl = []
for c in s:
    sl.append(c)
for c in t:
    tl.append(c)
sl.sort()
tl.sort(reverse=True)
s = "".join(sl)
t = "".join(tl)
print("Yes" if s < t 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 = list(input().strip())
s1 = sorted(s)
t = list(input().strip())
t1 = sorted(t,reverse=True)
if s1<t1:
    print("Yes")
else:
    print("No")

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

Solution (Python):
import sys
input = sys.stdin.readline
from collections import *

s = list(input()[:-1])
t = list(input()[:-1])
s.sort()
t.sort(reverse=True)
s = ''.join(s)
t = ''.join(t)

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

Solution (Python):
s = list(input())
s_num = len(s)
t = list(input())
t_num = len(t)
s.sort()
t.sort(reverse=True)
nagasa = min(s_num, t_num)
hantei = False
onaji = True
for i in range(nagasa):
    S = ord(s[i])
    T = ord(t[i])
    if S < T:
        hantei = True
        break
    if S != T:
        onaji = False
if onaji and nagasa < t_num:
    hantei = True
print("Yes" if hantei else "No")

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

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

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

N = len(S)
M = len(T)

n = min(N, M)
for i in range(n):
    if ord(S[i]) < ord(T[i]):
        print ('Yes')
        exit()
    elif ord(S[i]) > ord(T[i]):
        print ('No')
        exit()

if N < M:
    print ('Yes')
else:
    print ('No')

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

S = [0]*26
T = [0]*26
for i in range(len(s)):
    c = ord(s[i])-ord('a')
    S[c] += 1

for i in range(len(t)):
    c = ord(t[i])-ord('a')
    T[c] += 1

s_ = ''
for i in range(26):
    s_ += chr(i+ord('a'))*S[i]

t_ = ''
for i in reversed(range(26)):
    t_ += chr(i+ord('a'))*T[i]

X = [s_, t_]

if s_ == t_:
    print('No')
    exit()
Y = sorted(X)
if X[0] == Y[0]:
    print('Yes')
else:
    print('No')

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=list(input())
    t=list(input())
    s.sort()
    t.sort(reverse=True)
    if s<t:
        print('Yes')

    else:
        print('No')
resolve()

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

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

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

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

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

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort()
t = t[::-1]

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

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

S = [ord(s) for s in S]
T = [ord(s) for s in T]

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

LS = len(S)
LT = len(T)

ok = None
for i in range(min(LS,LT)):
  s = S[i]
  t = T[i]
  if s < t:
    ok = True
    break
  elif s == t:
    continue
  elif t < s:
    ok = False
    break

if ok:
  print('Yes')
elif ok == None:
  if LS < LT:
    print('Yes')
  else:
    print('No')
else:
  print('No')

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

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

s_str = ''.join(s)
t_str = ''.join(t)

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

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

a = sorted(a)
b = sorted(b,reverse=True)

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

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

a = sorted(a)
b = sorted(b,reverse=True)

N = len(a)
M = len(b)

can = False
i = 0

while i < N and i < M:
    if can == True:
      break

    if a[i] < b[i]:
        can = True
    elif a[i] > b[i]:
        break
    elif i==N - 1 and N < M:
        can = True
    i+=1

if can == True:
    print('Yes')
else:
    print('No')

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

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

if s_check < t_check:
    print("Yes")
else:
    print("No")