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


if __name__ == '__main__':
    main()

Solution (Python):
s=sorted(list(input()))
t=sorted(list(input()),reverse=1)
s1,t1='',''
for i in range(len(s)):
    s1+=s[i]
for i in range(len(t)):
    t1+=t[i]
print('Yes' if s1<t1 else 'No')

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

s = list(STR())
t = list(STR())
s.sort()
t.sort(reverse=True)
arr = [s, t]
arr.sort()
if arr[0] == s and s != arr[1]:
    print('Yes')
else:
    print('No')

Solution (Python):

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

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

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

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

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

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

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

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

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

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

Solution (Python):
s = sorted(input())
t = sorted(input())[::-1]
s = ''.join(s)
t = ''.join(t)
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('No')
else:
  sstt = [ss,tt]
  list = sorted(sstt)
  if list[0]==ss:
    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 = list(input())
t = list(input())
s.sort()
t.sort(reverse=-True)
S = ''.join(s)
T = ''.join(t)
chk = [S,T]
if S == T:
  print('No')
  exit()
else:
  chk.sort()
  if chk[0] == S:
    print('Yes')
  else:
    print('No')

Solution (Python):
s1=input()
s2=input()
if s1 == s2:
    print('No')
    exit()
s1 = list(s1)
s1.sort()
s1 = ''.join(map(str,s1))
s2 = list(s2)
s2.sort(reverse=True)
s2 = ''.join(map(str,s2))
check = [s1,s2]
check.sort()

if check[0] == s1:
    print('Yes')
else:
    print('No')

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

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

if sd < td:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()
t=input()
ss=sorted(s)
tt=sorted(t,reverse=True)
list=[ss,tt]
nlist=sorted(list)
if s==t:
    print('No')
else:
    if nlist[1] == tt:
        print('Yes')
    else:
        print('No')

Solution (Python):
def inpl(): return list(map(int, input().split()))
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()
t.reverse()
if s < t:
  print('Yes')
else:
  print('No')

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

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

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

Solution (Python):








def resolve():
    [s,t]=[str(input()) for i in range(2)]

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

resolve()

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

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

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

Solution (Python):
s = input()
t = input()
s_dash = []
t_dash = []
s_d = ""
t_d = ""
for i in range(len(s)):
  s_dash.append(s[i])
for j in range(len(t)):
  t_dash.append(t[j])
s_dash.sort()
t_dash.sort()
t_dash.reverse()
for i in range(len(s_dash)):
  s_d += s_dash[i]
for j in range(len(t_dash)):
  t_d += t_dash[j]
if s_d<t_d:
  print("Yes")
else:
  print("No")

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

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

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

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

Solution (Python):
S=input()
T=input()
s=[str(a) for a in S]
t=[str(b) for b in T]
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())
i = 0

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

length = min(len(s), len(t))

while i <= length-1:
    if s[i] == t[i]:
        i += 1
    elif s[i] < t[i]:
        print('Yes')
        exit()
    else:
        print('No')
        exit()

print('No' if length == len(t) else 'Yes')

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    S = list(input().strip())
    T = list(input().strip())

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

    for s, t in zip(S, T):
        if ord(t) > ord(s):
            print("Yes")
            return
        if ord(s) > ord(t):
            print("No")
            return
    else:
        if len(T) > len(S):
            print("Yes")
        else:
            print("No")



if __name__ == '__main__':
    main()

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=list(input())
t=list(input())
length=len(s)
len2=len(t)
for j in range(length):
    for i in range(0,length-j-1):
        if s[i]>s[i+1]:
            temp=s[i+1]
            s[i+1]=s[i]
            s[i]=temp
for j in range(len2):
    for i in range(0,len2-j-1):
        if t[i]<t[i+1]:
            temp=t[i+1]
            t[i+1]=t[i]
            t[i]=temp     
sd="".join(s)
td="".join(t)


if sd<td:
    print("Yes")
else:
    print("No")

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

Solution (Python):
import sys
s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()

ss = sorted(list(s), key=lambda x: x)
tt = sorted(list(t), key=lambda x: x)[::-1]
if "".join(ss) < "".join(tt):
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
s = list(s)
s.sort()
s = "".join(s)

t = input()
t = list(t)
t.sort()
t.reverse()
t = "".join(t)

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

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

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

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

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

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

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

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

Solution (Python):
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
s_l="".join(s)
t_l="".join(t)


if s_l<t_l:
            print('Yes')
else:
            print('No')

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

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

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

Solution (Python):
S, T = input(), input()
l1, l2 = [i for i in S], [i for i in T]
l1.sort()
l2.sort(reverse=True)
S1, T1 = "", ""
for i in range(len(l1)):
  S1 = S1[:] + l1[i]
for i in range(len(l2)):
  T1 = T1[:] + l2[i]
if S1 < T1:
  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 = list(str(input()))
t = list(str(input()))

s.sort()
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()

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

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

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

s1=""
t1=""

for i in range(len(s)):
    s1+=s[i]
for g in range(len(t)):
    t1+=t[g]

j=[s1,t1]
jSorted=sorted(j)

if j[0]==j[1]:
    print("No")
    exit()

if j[0]==jSorted[0]:
    print("Yes")
else:
    print("No")

Solution (Python):

s = input()
t = input()


s_L = list(s)
t_L = list(t)

s_L = sorted(s_L)
t_L = sorted(t_L,reverse=True)

s_L = "".join(s_L)
t_L = "".join(t_L)


if s_L < t_L:
    print("Yes")
else:
    print("No")

Solution (Python):
w_a = input()
w_b = input()

w_a = sorted(w_a)
w_b = sorted(w_b,reverse = True)

ord_a = list(map(lambda x: ord(x),w_a))
ord_b = list(map(lambda x: ord(x),w_b))

tmp = 0
for i in range(min(len(ord_a),len(ord_b))):
    if ord_a[i] < ord_b[i]:
        tmp -= 1
        break
    elif ord_a[i] > ord_b[i]:
        tmp += 1
        break

if w_a == w_b:
    print('No')
elif tmp == 1:
    print('No')
elif tmp == 0 and len(w_a) > len(w_b):
    print('No')
else:
    print('Yes')

Solution (Python):


s = sorted(input())
t = sorted(input())
a = s
b = sorted(t,reverse = True)

c = False

if len(s) < len(t):
    if s == t[:len(s)]:
        c = True
        
if c == False:
    for i in range(min(len(a),len(b))):
        if a[i] < b[i]:
            c = True
            break
        elif a[i] > b[i]:
            break

if c:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
s = sorted(list(str(input())))
t = sorted(list(str(input())), reverse = True)
u = min(len(s), len(t))
for i in range(min(len(s), len(t))):
    if s[i] < t[i]:
        print('Yes')
        sys.exit()
    if s[i] > t[i]:
        print('No')
        sys.exit()
if s[0:u] == t[0:u] and len(s) < len(t):
    print('Yes')
elif s[0:u] == t[0:u] and len(s) >= len(t):
    print('No')

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


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

a = []
a.append(s)
a.append(t)

if a == sorted(a) and s != t:
  print("Yes")
else:
  print("No")

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


t = input()
t_dash = sorted(t, reverse=True)


if s_dash < t_dash:
  print('Yes')
else:
  print('No')

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

Solution (Python):
s=sorted(list(input()))
t=sorted(list(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 = input().rstrip()
t = input().rstrip()

s_dash = "".join(sorted(s))
t_dash = "".join(reversed(sorted(t)))

print("Yes" if s_dash < t_dash else "No")

Solution (Python):
s  =input()
S = []
for c in s:
  S.append(c)
t = input()
T = []
for c in t:
  T.append(c)

S.sort()
s= ''.join(S)
T.sort(reverse=True)
t= ''.join(T)

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

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


d ={chr(i):i for i in range(97, 97+26)}

s = [d[i]for i in s]
t = [d[i]for i in t]

def check(s,t):
  if (len(s) == 0 )& (len(t)>0) :
    return 'Yes'
  elif (len(t) == 0 )& (len(s)>=0) :
    return 'No'
  a,b = min(s), max(t)
  if a< b:
    return 'Yes'
  elif a==b :
    return a
  else :
    return 'No'
    
while True :
  x = check(s,t)
  if type(x)== int :
    s.remove(x)
    t.remove(x)
  else :
    break
print(x)

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

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

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

Solution (Python):

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

Solution (Python):

def Two_Anagrams(s , t):

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

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

    if not ans and len(s) >= len(t):
        ans = "No"
    elif not ans:
        ans = "Yes"

    return ans

def main():
    s = list(str(input()))
    t = list(str(input()))
    print(Two_Anagrams(s , t))

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

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

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

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

import sys
N = min(len(sorted_s),len(sorted_t))

for i in range(N):
    if ord(sorted_s[i]) < ord(sorted_t[i]):
        print('Yes')
        sys.exit()
    elif ord(sorted_s[i]) > ord(sorted_t[i]):
        print('No')
        sys.exit()

if len(sorted_s) < len(sorted_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):
a = input()
b = input()
a = sorted(a)
b = sorted(b)[::-1]
if a < b:
    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 = input()
T = input()

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

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

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

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

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

ans = ["No", "Yes"]



flag = 0
for i in range(min(len(s), len(t))):
    if (s[i] < t[i]):
        flag = 1
        break
    elif (s[i] > t[i]):
        flag = 2
        break

if (len(s) < len(t)and flag == 0):
    flag = 1

print(ans[flag == 1])

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

for cs in s:
    for ct in t:
        if cs < ct:
            print('Yes')
            exit()

if len(s) < len(t) and len(set(s)) == 1 and len(set(t)) == 1:
    print('Yes')
else:
    print('No')

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

min_len = min(len(s),len(t))

ans = False

for i in range(min_len):
    if s[i] < t[i]:
        ans = True
        break

if s[:min_len] == t[:min_len]:
    if len(s) < len(t):
        ans = True
        
if ans:
    print('Yes')
else:
    print('No')

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

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

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

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

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

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

x = sorted(["".join(s), "".join(t[::-1])])
if "".join(s)==x[0] and s != t:
    print("Yes")
else:
    print("No")

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

Solution (Python):
print('Yes') if sorted(list(input()))<sorted(list(input()),reverse=True) 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)

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

print('Yes' if S_<T_ else 'No')

Solution (Python):
a = "".join(sorted(input()))
b = "".join(sorted(input(), reverse = True))


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

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

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

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

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

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

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

s = sorted(s)
s = ''.join(s)
t = sorted(t, reverse=1)
t = ''.join(t)
l = [s,t]
k = sorted(l)
if l==k:
    print('Yes')
else:
    print('No')

Solution (Python):
sLst, tLst = list(input()), list(input())
sLst.sort()
tLst.sort(reverse=True)

sd = ''.join(sLst)
td = ''.join(tLst)

if sd < td:
    print('Yes')
else:
    print('No')

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

S_list = []
T_list = []
for _ in S:
  S_list.append(_)
for _ in T:
  T_list.append(_)

S_list.sort()
T_list.sort(reverse=True)

S=''
T=''
for _ in S_list:
  S+=_
for _ in T_list:
  T+=_


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


print(ans)

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

a=[]
b=[]

for i in range(len(s)):
  a.append(s[i])
  
for i in range(len(t)):
  b.append(t[i])
  

a.sort()
b.sort(reverse=True)

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

Solution (Python):
s=sorted(str(input()))
t=sorted(str(input()))
t.reverse()
l=[s,t]
lis=sorted(l)
if s==t:
  print('No')
else:
  if l==lis:
    print('Yes')
  else:
    print('No')

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

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

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

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

if sol < tol: 
    print('Yes')
else:
    print('No')

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


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

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

Solution (Python):
s= list(input())
t= list(input())
ss=sorted(s)
tt=sorted(t,reverse=True)
sss=''.join(ss)
ttt=''.join(tt)
ans = []
ans.append(sss)
ans.append(ttt)
ans1=sorted(ans,key=str.lower)
if ans1[0]==ans[1]:
    print('No')
elif ans1[0]==sss:
    print('Yes')
else:
    print('No')

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

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
s_d = ""
for i in range(len(s)) :
    s_d += s[i]
t_d = ""
for i in range(len(t)) :
    t_d += t[i]
print("Yes" if s_d < t_d else "No")

Solution (Python):
s = str(input())
t = str(input())
s = sorted(s)
t = sorted(t, reverse = True)
if(''.join(s) < ''.join(t)):
    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 = [x for x in input()]
t = [x for x in input()]
s.sort()
t.sort(reverse=True)
s, t = "".join(s), "".join(t)
ans = "No"
m = min(len(s), len(t))
for i in range(m):
    if s[i] < t[i]:
        ans = "Yes"
        break
if ans == "No" and s[:m] == t[:m] and len(s) < len(t): ans = "Yes"
print(ans)

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

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

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

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

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

Solution (Python):
x=list(input())
x.sort()
y=list(input())
y.sort(reverse=True)
print(["No", "Yes"][x<y])

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


if __name__ == '__main__':
    main()

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 = input()
t = input()
slist = [ord(i) for i in s]
tlist = [ord(i) for i in t]
slist.sort()
tlist.sort(reverse=True)

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

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

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

Solution (Python):
list_s = list(input())
list_t = list(input())

list_s.sort()
list_t.sort(reverse = True)

if list_s < list_t :
    print("Yes")
else :
    print("No")

Solution (Python):
s = input()
t = input()
alf = 'abcdefghijklmnopqrstuvwxyz'
r = 'No'
if len(s)<len(t) and s==t[:len(s)]:
    r = 'Yes'

s = sorted(s)
t = sorted(t, reverse=True)
for i in range(min(len(s),len(t))):
    si = alf.index(s[i])
    ti = alf.index(t[i])
    if si < ti:
        r = 'Yes'
        break
    elif si == ti:
        continue
    else:
        break
print(r)

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

ans = 'No'

if ("".join(s) < "".join(t)):
  ans = 'Yes'
print(ans)

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

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

Solution (Python):

s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
sd = "".join(s)
td = "".join(t)
print("Yes" if sd < td else "No")

Solution (Python):
s = input()
t = input()
flag = False
for i in range(len(s)):
  for j in range(len(t)):
    if s[i] < t[j]:
      flag = True

if s in t and len(s) < len(t):
  flag = True

if flag:
  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 = sorted(s)
t = sorted(t, reverse=True)
u = min(len(s), len(t))
if s == t:
    print("No")
    exit()
if len(s) < len(t) and s == t[:len(s)]:
    print("Yes")
    exit()
else:
    for i in range(u):
        if s[i] > t[i]:
            print("No")
            exit()
        elif s[i] == t[i]:
            pass
        else:
            print("Yes")
            exit()
    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 = input()
T = input()

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

Solution (Python):
from collections import Counter

def solve(s, t):
    sc = sorted(s)
    tc = sorted(t, reverse=True)
    return 'Yes' if sc < tc else 'No'

_s = input()
_t = input()
print(solve(_s, _t))

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

for s, t in zip(sorted(S), sorted(T, reverse=True)):
    if s < t:
        print('Yes')
        break
    elif s > t:
        print('No')
        break
else:
    print('Yes' if len(S) < len(T) else '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 = input()
t = input()
ret = sorted(s) < sorted(t, reverse=True)
print('Yes' if ret 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(reverse=True)

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

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

Solution (Python):
s=list(input())
t=list(input())
t.sort(reverse=True)
tt=sorted(t)
t=''.join(t)
tt=''.join(tt)
s.sort()
s=''.join(s)
dic=[s,t]
dic.sort()
if dic[0]==s and tt!=s:
	print('Yes')
else:
	print('No')

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

Solution (Python):
s=input()
S=[s[c] for c in range(len(s))]
S.sort()
t=input()
T=[t[d] for d in range(len(t))]
T.sort(reverse=True)


print(["No","Yes"][(S<T)])

Solution (Python):
s = input()
t = input()
sList = sorted(s)
tList = sorted(t, reverse=True)
num = min(len(s), len(t))
for i in range(num):    
    if sList[i] == tList[i]:
        continue
    if sList[i] < tList[i]:
        flag = True
        break
    if sList[i] > tList[i]:
        flag = False
        break
try: 
    if flag:
        print("Yes")
    else:
        print("No")
except NameError as flag:
    if len(s) < len(t):
        print("Yes")
    else:
        print("No")

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

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

if s_ < t_:
    print('Yes')
else:
    print('No')

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

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

Solution (Python):




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


if __name__ == "__main__":
    main()

Solution (Python):
s = sorted(input())
t = sorted(input(),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("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):
try:
    s = input()
    t = input()
    s_ = sorted(s)
    t_ = sorted(t, reverse=True)
    print('Yes' if s_<t_ else 'No')
except EOFError:
    pass

Solution (Python):
def qsort(array):
    if len(array) < 2:
        return array
    else:
        pivot = array[0]
        less = [i for i in array[1:] if i <= pivot]
        greater = [i for i in array[1:] if i > pivot]
        return qsort(less) + [pivot] + qsort(greater)

si = input()
ti = input()

s_sort = qsort(si)
t_sort = qsort(ti)

s = ''
t = ''

for i in s_sort:
    s += i
for i in t_sort[::-1]:
    t += i
if s < t:
    print('Yes')
else:
    print('No')

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

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

Solution (Python):
rev_s = "".join(sorted(input(),reverse=False))
rev_t = "".join(sorted(input(),reverse=True))


if rev_t > rev_s:
    print("Yes")
else:
    print("No")

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

S = []
T = []
for i in s:
    S.append(i)
for j in t:
    T.append(j)
S = sorted(S)
T = list(reversed(sorted(T)))

a = "".join(S)
b = "".join(T)
if a < b:
    print("Yes")
else:
    print("No")

Solution (Python):
print('YNeos'[sorted(input())>=sorted(input())[::-1]::2])

Solution (Python):
s = sorted(input())
t = sorted(input())[::-1]
print('YNeos'[s>=t::2])

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

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

for i, j in zip(s, t):
  if i < j:
    print("Yes")
    break
  elif i > j:
    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)
s=''.join(s)
t=''.join(t)
if t>s:
  print('Yes')
else:
  print('No')

Solution (Python):
s=[i for i in input()]
t=[i for i in input()]
s1="".join(sorted(s))
t1="".join(sorted(t)[::-1])
if s1>=t1:print("No")
else:print("Yes")

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

for i, j in zip(s, t):
  if i < j:
    print("Yes")
    break
  elif i > j:
    print("No")
    break
else:
  if len(s) < len(t):
    print("Yes")
  else:
    print("No")

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



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

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

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

if sd < td:
    print("Yes")
else:
    print("No")