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 = list(input())
t = list(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]
flag = -1
for i,j in zip(s,t):
    if ord(i) < ord(j):
        flag = 1
        break
    elif ord(i) == ord(j):
            flag = 0
    else:
        flag = -1
        break

if flag ==1:
    print("Yes")
elif flag == -1:
    print("No")
else:
    if len(s) < len(t):
        print("Yes")
    elif len(s) >= len(t):
        print("No")

Solution (Python):
a = [input() for i in range(2)]

sp = "".join(sorted(list(a[0])))
tmp = list(a[1])
tmp.sort()
tmp.reverse()
tp = "".join(tmp)

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

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

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

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

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

smin = "".join(sorted([c for c in s]))
tmax = "".join(reversed(sorted([c for c in t])))

print('Yes' if smin < tmax 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):
def resolve():
    s = input()
    t = input()
    ls = list()
    lt = list()
    for c in s:
        ls.append(ord(c))
    for c in t:
        lt.append(ord(c))
    ls.sort()
    lt.sort()
    
    can = False
    if len(ls) == ls.count(ls[0]) and len(lt) == lt.count(lt[0]) and len(ls) < len(lt):
        can = True
    else:
        for i in range(len(lt)-1, -1, -1):
            if ls[0] < lt[i]:
                can = True
                break

    if can:
        print("Yes")
    else:
        print("No")
resolve()

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

s_list = [i for i in s]
t_list = [i for i in t]
s_list.sort()
t_list.sort()
t_list.reverse()
s = ''.join(s_list)
t = ''.join(t_list)

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

Solution (Python):
S=list(map(lambda x:x,input()))
T=list(map(lambda x:x,input()))

S.sort()
T.sort(reverse=True)
if S<T:
    print("Yes")
else:
    print("No")

Solution (Python):
S=list(map(lambda x:x,input()))
T=list(map(lambda x:x,input()))

S.sort()
T.sort(reverse=True)
if S<T:
    print("Yes")
else:
    print("No")

Solution (Python):

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


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


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


ans = ""
N = min(len(s),len(t))
for i in range(N):
    if ord(s[i]) == ord(t[i]):
        pass
    elif ord(s[i]) < ord(t[i]):
        ans = "Yes"
        break
    else:
        ans = "No"
        break
else: 
    if len(s) < len(t):
        ans = "Yes"
    else:
        ans = "No"


print(ans)

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

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

Solution (Python):
p = input()
q = input()

s = list(p)
t = list(q)

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

for i in range(len(s)):
    front = s[i]
    rear = t.pop()
    f = ord(front)
    r = ord(rear)
    if t == []:
        answer = False
        break
    if f == r:
        continue
    elif f < r:
        answer = True
        break
    else:
        answer = False
        break

if answer:
    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(input())
t=list(input())
s.sort()
t.sort(reverse=True)
if s<t:
    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(input()))
t="".join(sorted(input(),reverse=True))

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

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

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

if s_n < t_n:
  print('Yes')

else:
  print('No')

Solution (Python):
a=input()
b=input()
la,lb = len(a), len(b)
if a==b:
    print('No')
elif (la< lb and set(a)==set(b)):
    print('Yes')
else:
    sa = sorted(a)
    sb = sorted(b, reverse = True)
    if (sa[:lb] < sb):
        print('Yes')
    else:
        print('No')

Solution (Python):

 

 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy
 

 










 
S = input()
T = input()

if S == T:
    print("No")
    sys.exit()

Sx = ''.join(sorted(S))
Tx = ''.join(sorted(T, reverse=True))

L = []
L.append(Sx)
L.append(Tx)

L.sort()

if L[0] == Sx:
    print("Yes")
else:
    print("No")

Solution (Python):
x=sorted(list(input()))
y=sorted(list(input()),reverse=True)
a=""
b=""
for p in x:
  a+=p
for q in y:
  b+=q
if a<b:
  print("Yes")
else:
  print("No")

Solution (Python):

import sys
from collections import deque, defaultdict
from math import sqrt, factorial





def solve():
    s = [x for x in input()]
    t = [x for x in input()]
    s.sort()
    t.sort(reverse=True)
    if s < t:
        print("Yes")
    else:
        print("No")



    

t = 1

for case in range(1,t+1):
    ans = solve()


"""



"""

Solution (Python):
s = list(input())
t = list(input())
n, m = len(s), len(t)
s.sort()
t.sort(reverse = True)
if n < m:
    jud = True
else:
    jud = False
for i in range(min(n, m)):
    if s[i] > t[i]:
        jud = False
        break
    elif s[i] < t[i]:
        jud = True
        break
if jud:
    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 = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
if s < t:
    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):


def solve(s,t):

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

  return s < t



def main():
  S = input()
  T = input()
  print("Yes" if solve(S,T) else "No")
  return

if __name__ == '__main__':
  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 = ''.join(sorted(input()))
t = ''.join(reversed(sorted(input())))

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

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

s = list(s)
s.sort()
s2 = "".join(s)

t = list(t)
t.sort(reverse=True)
t2 = "".join(t)

if s2 < t2:
  print("Yes")
else:
  print("No")

Solution (Python):
s = str(input())
t = str(input())
s = sorted(s)
t = sorted(t,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 = input()
s_sort = ''.join(sorted(s))

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

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

Solution (Python):
S = list(input())
T = list(input())
s = []
t = []
for i in S:
  s.append(int(ord(i)))
for i in T:
  t.append(int(ord(i)))

s.sort()
t.sort()
for i in range(max(len(s),len(t))):
  if i >= min(len(s),len(t)):
    break
  elif max(t) > s[i]:
    print("Yes")
    exit(0)
  elif s[i] not in t:
    break
  else:
    t.remove(s[i])
    s.remove(s[i])
    
  
if len(t) > len(s):
  for i in s:
    if i not in t:
      print("No")
      exit(0)
    else:
      t.remove(i)
  print("Yes")
else:
  print("No")

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

Solution (Python):
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

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

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):


s = sorted(list(str(input())))
t = sorted(list(str(input())), reverse=True)

if ''.join(s) < ''.join(t):
    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 = str(input())
t = str(input())
S = [i for i in s]
S.sort()
T = [i for i in t]
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]

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

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

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

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

Solution (Python):
def actual(s, t):
    s = ''.join(sorted(s))
    t = ''.join(sorted(t, reverse=True))

    if s < t:
        return 'Yes'

    return 'No'

s = input()
t = input()

print(actual(s, t))

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

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

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

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

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

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

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

Solution (Python):
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

def get():
  x = [ord(i) for i in list(input())]
  return x

s = sorted(get())
t = sorted(get(),reverse=True)
s.extend([0]*(len(t)-len(s)))
t.extend([0]*(len(s)-len(t)))

for i in range(len(s)):
  if s[i]==t[i]:
    continue
  elif s[i]<t[i]:
    print("Yes")
    exit()
  else:
    print("No")
    exit()
print("No")

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

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

if s == t:
    print('No')

else:
    a = sorted([s, t])
    if a[0] == s:
        print('Yes')

    if a[0] == t:
        print('No')

Solution (Python):

S = input()
T = input()

S = sorted(S, reverse=False)
T = sorted(T, reverse=True)
if S >= T:
    print('No')
else:
    print('Yes')

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

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

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

Solution (Python):
import math

import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit


ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    s = list(input())
    t = list(input())
    s.sort()
    t.sort(reverse=True)
    ss = "".join(s)
    st = "".join(t)
    if ss < st:
        print("Yes")
    else:
        print("No")


    return None

if __name__ == '__main__':
    main()

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")
else:
  print("Yes")

Solution (Python):






s = input()
t = input()





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

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

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

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


if tstr > sstr:
    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):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

Solution (Python):
s = input()
t = input()
s = sorted(s)
t = sorted(t)
S = ""
T = ""
for i in range(len(s)):
    S += s[i]
for i in range(len(t)):
    T += t[len(t) - 1 - i]
print("Yes" if T > S else "No")

Solution (Python):
import math
def main():
  s = input()
  t = input()
  sx=sorted(s)
  tx=sorted(t,reverse=True)
  if sx<tx:
    print('Yes')
  else:
    print('No')
main()

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

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

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

for i in range(n):
    if ord(s[i])<ord(t[i]):
        print("Yes")
        exit()
    elif ord(t[i])<ord(s[i]):
        print("No")
        exit()
        
if len(s)<len(t):
    print("Yes")
else:
    print("No")

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

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

if not (1 <= len(s) <= 100 and 1 <= len(t) <= 100):
    sys.exit()

if s == t:
    print('No')
    sys.exit()

s.sort()
t.sort(reverse=True)
result = []
result.append(''.join(s))
result.append(''.join(t))
result.sort()

if result[0] == ''.join(s):
    print('Yes')
else:
    print('No')

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

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

list=[s]+[t]
list.sort()

if list[0]==t:
    print("No")
else:
    print("Yes")

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

a = s()
t = s()

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

Solution (Python):
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t, reverse=True)
for i in range(min(len(s), len(t))):
  if s[i] > t[i]:
    print("No")
    exit()
  elif s[i] < t[i]:
    print("Yes")
    exit()
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)

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

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

Solution (Python):
s = input()
t = input()
slst = []
tlst = []
for i in s:
  slst.append(i)
for i in t:
  tlst.append(i)
slst.sort(key=lambda x: ord(x))
tlst.sort(key=lambda x: ord(x), reverse=True)
s = ''.join(slst)
t = ''.join(tlst)
print('Yes' if s < t else 'No')

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

Solution (Python):
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


s = list(S())
t = list(S())

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

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

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

if ss < st:
    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):
print("Yes" if sorted(input())<sorted(input())[::-1] else "No")

Solution (Python):
import sys

s = input()
t = input()

s = sorted(s)
t = sorted(t)[::-1]

N = len(s)
M = len(t)

if N < M:
    if s == t[:N]:
        print('Yes')
        sys.exit()
N = min(N, M)
i = 0
while i < N and s[i] == t[i]:
    i += 1
if i < N and s[i] < t[i]:
    print('Yes')
else:
    print('No')

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

    s = sorted(s)
    t = sorted(t)[::-1]

    N = len(s)
    M = len(t)

    if N < M:
        if s == t[:N]:
            print('Yes')
            return
    N = min(N, M)
    i = 0
    while i < N and s[i] == t[i]:
        i += 1
    if i < N and s[i] < t[i]:
        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):
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("Yes" if s<t else "No")

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

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

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    S = list(input())
    T = list(input())
    S.sort()
    T.sort(reverse = True)
    if S < T:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    main()

Solution (Python):
s,t=list(input()),list(input())
if s==t: print('No');exit()
s.sort();t.sort(reverse=True)
l=[''.join(s),''.join(t)]
r=sorted(l)
print('Yes' if l==r 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):
import sys
import math
import numpy as np
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

S = list(s())
T = list(s())
if S == T:
    print('No')
    exit()
S.sort()
T.sort(reverse=True)
for i in range(min(len(S),len(T))):
    if ord(S[i]) > ord(T[i]):
        print('No')
        exit()
    if ord(S[i]) < ord(T[i]):
        print('Yes')
        exit()
if len(S) > len(T):
    print('No')
else:
    print('Yes')

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

Solution (Python):
aa, bb = open(0).read().splitlines()

aa = sorted(aa)

bb = sorted(bb, reverse=True)

import sys
for a, b in zip(aa, bb):
    if a == b:
        continue
    else:
        if a<b:
            print('Yes')
            sys.exit()
        else:
            print('No')
            sys.exit()
        break
if len(aa)<len(bb):
    print('Yes')
else:
    print('No')

Solution (Python):
s=sorted(input())
t=sorted(input())[::-1]
A=True
for i in range(min(len(s),len(t))):
    if s[i]<t[i]:
        A = True
        break
    elif s[i]>t[i]:
        A = False
        break
    else:
        if len(s)<len(t): A=True
        else:A= False
print('Yes' if A else '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()
t.reverse()
  
if s < 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):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

s = X()
t = X()

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

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

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

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

Solution (Python):
def calculate(s, t):
    a = sorted(s)
    b = sorted(t,reverse=True)

    m = "".join(a)
    k = "".join(b)

    if m < k:
        print("Yes")
    else:
        print("No")














s = input()
t = input()
calculate(s, t)

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

Solution (Python):
import sys
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
num = min(len(s), len(t))
for i in range(num):
    if ord(s[i]) > ord(t[i]):
        print('No')
        sys.exit()
    elif ord(s[i]) < ord(t[i]):
        print('Yes')
        sys.exit()
    elif ord(s[i]) == ord(t[i]) and i == num-1:
        if len(s) < len(t):
            print('Yes')
            sys.exit()
    elif ord(s[i]) == ord(t[i]):
        continue

print('No')

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

if s==t:
    print("No")
else:
    flg=(len(s)<len(t))
    for a in s:
        if not(a in t):
            flg=False
            break
    if flg:
        print("Yes")
    else:
        flg=False
        for a in s:
            for b in t:
                if ord(a)<ord(b):
                    flg=True
                    break
            if flg:
                break
        if flg:
            print("Yes")
        else:
            print("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):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    s = sorted(input())
    t = sorted(input(), reverse=True)
    n = len(s)
    m = len(t)
    if n < m:
        for i in range(n):
            if s[i] != t[i]:
                break
        else:
            print("Yes")
            sys.exit()
    for i in range(min(n, m)):
        if s[i] != t[i]:
            if s[i] < t[i]:
                print("Yes")
                sys.exit()
            break
    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):
s = sorted(list(input()))
t = list(input())
t.sort(reverse = True)
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)
s = "".join(s)
t = "".join(t)
if t > s:
    print("Yes")
else:
    print("No")

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

flag = -10
for i in range(min(len(s) , len(t))):
    if s1[i] < t1[i]:
        flag = 1
        break
    elif s1[i] == t1[i]:
        continue
    elif s1[i] > t1[i]:
        flag = 2
        break

if (flag == -10) and (len(s) < len(t)):
    print('Yes')
    
if (flag == -10) and (len(s) >= len(t)):
    print('No')
    
if flag == 1:
    print('Yes')
if flag == 2:
    print('No')

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('Yes')
else:
    print('No')

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

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

ans = 'Yes' if s < t else 'No'

print(ans)

Solution (Python):
s = input()
t = input()
if sorted(s) < sorted(t) or sorted(s) < sorted(t)[::-1]:
  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_list = [c for c in s]
t_list = [c for c in t]

s_list.sort()
t_list.sort()

sd = "".join(s_list)
td = "".join(t_list[::-1])

if sd < td:
    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")

exit()

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

Solution (Python):
s=input()
t=input()
if s==t:
    print('No')
    exit(0)
alp="abcdefghijklmnopqrstuvwxyz"
d={}
e={}
for i in range(len(alp)):
    d[alp[i]]=i
    e[i]=alp[i]

s_array = []
for i in range(len(s)):
    s_array.append(d[s[i]])

s_array=sorted(s_array)

t_array=[]
for j in range(len(t)):
    t_array.append(d[t[j]])

t_array=sorted(t_array,reverse=True)

s=''
for i in range(len(s_array)):
    s+=e[s_array[i]]

t=''
for j in range(len(t_array)):
    t+=e[t_array[j]]

dictionary={}
dictionary[s]=1
dictionary[t]=1

dictionary=sorted(dictionary.items(),key=lambda x: x[0])

if dictionary[0][0]==s:
    print('Yes')
else:
    print('No')

Solution (Python):

if __name__ == '__main__':
    a = input()
    b = input()
    asort=''.join(sorted(a))
    bsort=''.join(sorted(b,reverse=True))

    if asort <bsort:
        print("Yes")
    else:
        print("No")

Solution (Python):
s = sorted(list(input()))
t = sorted(list(input()))[::-1]
            
for S, T in zip(s, t):
    if S < T:
        print('Yes')
        exit()
    elif S > T:
        print('No')
        exit()
    else:
        continue

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

Solution (Python):
import sys
read = sys.stdin.read
def main():
    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')


if __name__ == '__main__':
    main()

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

Solution (Python):
s = [p for p in input()]
t = [p for p in input()]
s.sort()
t.sort()
t.reverse()
print('Yes' if s < t else 'No')

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

Solution (Python):
s0 = input()
t0 = input()
list_s0 = list(s0)
list_t0 = list(t0)
list_s0.sort()
list_t0.sort(reverse = True)
s1 = "".join(list_s0)
t1 = "".join(list_t0)
if s1 < t1:
  print("Yes")
else:
  print("No")

Solution (Python):
s = str(input())
t = str(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)

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

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

Solution (Python):
import sys
s = list(input())
t = list(input())
s.sort()
t.sort()
for x, y in zip(s, t[::-1]):
    if x > y:
        print('No')
        sys.exit()
    elif x == y:
        continue
    else:
        print('Yes')
        sys.exit()
if len(s) < len(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, t = [input() for _ in range(2)]
print("Yes" if "".join(sorted(s)) < "".join(sorted(t, reverse=True)) else "No")

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

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

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