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

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

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

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

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

Solution (Python):
n, m = [sorted(list(input())) for i in range(2)]
print("Yes" if n < m[::-1] else "No")

Solution (Python):
s = list(input())
t = list(input())
s = [ord(i) for i in s]
t = [ord(i) for i in t]
s_new = sorted(s)
t_new = sorted(t,reverse=True)
flag = False
for i in range(len(s)):
    if len(t) == i:
        break
        
        
    if s_new[i] < t_new[i]:
        flag = True
        break
        
    elif s_new[i] > t_new[i]:
        break
        
    if i == len(s)-1:
        if i < len(t)-1:
            flag = True
        
print('Yes' if flag ==True else 'No')

Solution (Python):
s = input()
t = input()
s_list = list(s)
t_list = list(t)
s_list.sort()
t_list.sort(reverse = True)
alphabets = [chr(i) for i in range(97, 97+26)]  
numbers = [i for i in range(1, 27)]
dict1 = dict(zip(alphabets, numbers))
frag = False
for i in range(min(len(s_list),len(t_list))):
  if dict1[s_list[i]] < dict1[t_list[i]]:
    frag = True
    break
  elif dict1[s_list[i]] > dict1[t_list[i]]:
    break
  elif dict1[s_list[i]] == dict1[t_list[i]]:
    if i == min(len(s_list),len(t_list)) - 1 and len(s_list) < len(t_list):
      frag = True
      break
    else:
      continue
if frag:
  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 print('No')]

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

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

a.sort()
b.sort(reverse=True)
f = [int(len(b)), int(len(a))]
e = min(f)
for i in range(int(e)):
    c =[a[i],b[i]]
    d = sorted(c)
    if i != int(e)-1:
        if a[i] == b[i]:
            continue
        elif c != d:
            print("No")
            break
        else:
            print("Yes")
            break
    if i == int(e)-1:
        if a[i] == b[i]:
            if int(len(a)) >= int(len(b)):
                print("No")
            else:
                print("Yes")
        elif c != d:
            print("No")
            break
        else:
            print("Yes")
            break

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

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

s.sort()
t.sort(reverse=True)
ss = ''.join(s)
tt = ''.join(t)

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

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

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


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


t = t[::-1]


sf = len(s)
tf = len(t)


flag = 0

i = 0

while sf>0 and tf>0:
    if s[i] < t[i]:
        print('Yes')
        flag += 1
        break
    elif s[i] > t[i]:
        print('No')
        flag += 1
        break
    elif s[i] == t[i]:
        sf -= 1
        tf -= 1
        i += 1

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

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

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

s.sort()
t.sort()
t=t[::-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("Yes")
else:
    print("No")

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

Solution (Python):
s=sorted;i=input;print("NYoe s"[s(i())<s(i())[::-1]::2])

Solution (Python):
s = sorted
i = input
print(["No", "Yes"][s(i()) < s(i(), reverse=True)])

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

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

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

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

ans = "No"
l = [sa, ta]
l.sort()
if l[1] == ta:
    ans = "Yes"
if l[0] == l[1]:
    ans = "No"
print(ans)

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

al="".join(a)
bl="".join(b)

flag = al < bl

if flag == True:
  print("Yes")
else:
  print("No")

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

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

if sorted(s)<sorted(t)[::-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 = sorted(input())
t = sorted(input(), reverse=True)
N = len(s)
M = len(t)

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

Solution (Python):
url = "https://atcoder.jp/contests/abc082/tasks/abc082_b"


def main():
    s1, s2 = [input() for i in range(2)]
    l1 = sorted(list(s1))
    l2 = sorted(list(s2), reverse=True)
    indx = 0
    if len(l1) > len(l2):
        indx = len(l2)
    else:
        indx = len(l1)
    for i in range(indx):
        if l1[i] < l2[i]:
            print('Yes')
            exit()
    if len(l1) < len(l2) and l1[-1] <= l2[-1]:
        print('Yes')
        exit()
    print('No')




if __name__ == '__main__':
    main()

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

S = ''
T = ''

temps = sorted(s)
tempt = sorted(t, reverse=True)
for i in range(len(s)):
    S += temps[i]
for i in range(len(t)):
    T += tempt[i]

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

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

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

Solution (Python):
ss = list(input())
tt = list(input())

ss.sort()
tt.sort(reverse = True)
s1 = ''
t1 = ''
ans = []
for i in ss:
    s1 += i
ans.append(s1)     
for i in tt:
    t1 += i 
ans.append(t1)
ans.sort()
num = ans.index(t1)
if num == 1:
    print('Yes')
else:
    print('No')

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

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

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

Solution (Python):
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A = list(iss())
    B = list(iss())
    A.sort()
    B.sort(reverse=True)
    print('Yes' if ''.join(A) < ''.join(B) else 'No')


if __name__ == '__main__':
    main()

Solution (Python):
s = list(input())
s.sort()
t = list(input())
t.sort()
t.reverse()
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=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
s1=''.join(s)
t1=''.join(t)
k=[s1,t1]
k.sort()
if s1==t1:print('No')
elif k[0]==s1:print('Yes')
else:print('No')

Solution (Python):




"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 

 


 
 
 
def main():
  s = input()
  t = input()
  
  s = sorted(list(s))
  t = sorted(list(t),reverse=True)
  
  if s < t:
    print('Yes')
  else:
    print('No')
  
  
if __name__ == '__main__':
  main()

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 = 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 = list(input())
t = list(input())
s = [ord(i) for i in s]
t = [ord(i) for i in t]
s_new = sorted(s)
t_new = sorted(t,reverse=True)
flag = False
for i in range(len(s)):
    if len(t) == i:
        break
        
        
    if s_new[i] < t_new[i]:
        flag = True
        break
        
    elif s_new[i] > t_new[i]:
        break
        
    if i == len(s)-1:
        if i < len(t)-1:
            flag = True
        
print('Yes' if flag ==True else 'No')

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

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


kaburi=min(len(s), len(t))
for i in range(kaburi):
    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):
import sys

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

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

if st == tt:
    print("No")
    sys.exit()

stlist = [st, tt]
stlist = sorted(stlist)
if stlist[0] == st:
    print("Yes")
else:
    print("No")

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

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

s = ''.join(list_s)
t = ''.join(list_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):
x=list(str(input()))
y=list(str(input()))
x.sort()
y.sort(reverse=True)

while len(x)!=len(y):
	if len(x)>len(y):
		y.append('Z')
	else:
		x.append('Z')
ans=0
i=0

while  ans==0 and i!=len(x):
	if ord(x[i])>ord(y[i]):
		ans=-1
	elif ord(x[i])<ord(y[i]):
		ans=1
	else:
		i=i+1
if ans==1:
	print('Yes')
else:
	print('No')

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

Solution (Python):
base=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
s=input()
t=input()

S=[]
T=[]


answer="NO"

for i in s:
    S.append(base.index(i))
for j in t:
    T.append(base.index(j))
S=sorted(S)
T=sorted(T,reverse=True)



for k in range(min(len(S),len(T))):
    if S[k]>T[k]:
        answer="No"
        break
    elif S[k]<T[k]:
        answer="Yes"
        break
if answer=="NO" and len(S)<len(T):
    answer="Yes"
elif answer=="NO" and len(S)>=len(T):
    answer="No"

print(answer)

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)

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

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

S = readline().rstrip().decode()
T = readline().rstrip().decode()

s = [ S[i] for i in range(len(S))]
t = [ T[i] for i in range(len(T))]

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

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

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

Solution (Python):
def main():
    s = input()
    t = input()
    sl = [c for c in s]
    tl = [c for c in t]
    sl.sort()
    tl.sort(reverse=True)
    s2 = "".join(sl)
    t2 = "".join(tl)

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


if __name__ == '__main__':
    main()

Solution (Python):
s,t=[sorted(input())for i in(0,0)];print("YNeos"[s>=t[::-1]::2])

Solution (Python):
s=input()
t=input()
if s==t:
    print('No')
    exit()
s=list(s)
t=list(t)
s=sorted(s)
t=sorted(t,reverse=True)

s=''.join(list(s))
t=''.join(list(t))
l=[s,t]
l.sort()
if l[0]==s:
    print('Yes')
else:
    print('No')

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

s.sort()
t.sort(reverse=True)
ss = ''.join(s)
ts = ''.join(t)

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

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

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

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

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

Solution (Python):

def resolve():
    s=list(input())
    t=list(input())
    ss=sorted(s)
    tt=sorted(t,reverse=True)
    if ss<tt:
        print('Yes')
    else:
        print('No')


resolve()

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

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

sl = len(s)
tl = len(t)

s = set(s)
t = set(t)

flag = False
for x in s:
    for y in t:
        if x < y:
            flag = True
            break
    if flag:
        break

if s == t and sl < tl:
    flag = True

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
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
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

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

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

    s = ''.join(sorted(list(s)))
    t = ''.join(reversed(sorted(list(t))))

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

    return


if __name__ == '__main__':
    main()

Solution (Python):
s = sorted(list(input()))
t = sorted(list(input()), 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 = [str(x) for x in input()]
t = [str(x) for x in input()]
s = sorted(s)
t = sorted(t,reverse = True)

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

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


if __name__ == '__main__':
    main()

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

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

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

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

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

Solution (Python):

import math
import itertools
import statistics

import collections

s = input()
t = input()

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


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

Solution (Python):
s = list(input())
t = list(input())
alph = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
s0, t0 = [], []
for i in range(26):
    for j in s:
        if alph[i] == j:
            s0.append(j)
    for j in t:
        if alph[25 - i] == j:
            t0.append(j)
s0 = "".join(s0)
t0 = "".join(t0)
print("Yes" if s0 < t0 else "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):
s = list(input())
t = list(input())

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

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

Solution (Python):
import collections

s = str(input())
t = str(input())
f = s + t
c = collections.Counter(f)
red = False
if len(c) == 1:
    if len(s) < len(t):
        red = True

for i in s:
    for k in t:
        if i < k:
            red = True
            break
if red:
    print("Yes")
else:
    print("No")

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

t.sort(reverse=True)


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

Solution (Python):
import math

a=input()
b=input()

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

print("Yes" if c<d 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):
s = str(input())
t = str(input())

s = list(map(ord,s))
t = list(map(ord,t))
s.sort()
t.sort(reverse=True)
if s < t:
    print('Yes')
else:
    print('No')

Solution (Python):
n = input()

n = ''.join(sorted(n))

m = input()

m = ''.join(sorted(m, reverse = True))




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

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

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

s, t = [c for c in s], [c for c in t]
s = sorted(s)
t = sorted(t, reverse=True)

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

if [s, t]==sorted([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 = list(input())
t = list(input())

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

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

Solution (Python):
import sys


def main():
    s = sorted(input())
    t = sorted(input())[::-1]

    for i, j in zip(s, t):
        if i == j:
            continue
        else:
            if ord(i) > ord(j):
                print('No')
                sys.exit(0)
            else:
                print('Yes')
                sys.exit(0)

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


if __name__ == "__main__":
    main()

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

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

Solution (Python):
s,t = [sorted(list(input())) for _ in range(2)]
t.reverse()
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()
t = input()

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

Solution (Python):
s=input()
t=input()
f1=[0]*26
f2=[0]*26
for i in s:
    f1[ord(i)-ord('a')]+=1
for i in t:
    f2[ord(i)-ord('a')]+=1
for i in range(26):
    if f1[i]:
        sm=i
        break
for i in range(25,-1,-1):
    if f2[i]:
        lg=i
        break
if sm<lg:
    print('Yes')
else:
    flag=True
    for i in range(26):
        if f1[i]>f2[i]:
            flag=False
            break
    if len(s)<len(t) and flag:
        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 = input()
t = input()

sd = ''.join(sorted([i for i in s]))
td = ''.join(sorted([i for i in t], reverse=True))
if sd < td:
    print('Yes')
else:
    print('No')

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

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

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

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

Solution (Python):
def f(s):
    sx=[s[i] for i in range(len(s))]
    sx.sort()
    return "".join(sx)
s=input()
t=input()
print("Yes" if f(s)<f(t)[::-1] else "No")

Solution (Python):
def f(s):
    sx=[0]*26
    for i in range (len(s)):
        p=ord(s[i])-ord("a")
        sx[p]+=1
    string=""
    for i in range(26):
        for _ in range(sx[i]):
            string+=chr(i+ord("a"))
    return string
s=input()
t=input()
print("Yes" if f(s)<f(t)[::-1] else "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())[::-1]
print("Yes" if s < t else "No")

Solution (Python):
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = sys.stdin.buffer.readline().decode().rstrip()
    T = sys.stdin.buffer.readline().decode().rstrip()

    print('Yes' if "".join(sorted(S)) < "".join(reversed(sorted(T))) else 'No')


if __name__ == '__main__':
    main()

Solution (Python):
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor



dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

s = input()
t = input()
if s == t:
    print('No')
    exit()
ss = sorted(s)
tt = sorted(t, reverse=True)
sss = ''.join(ss)
ttt = ''.join(tt)
if max(sss, ttt) == ttt:
    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 = sorted(s)
T = sorted(t,reverse = True)
if "".join(S) >= "".join(T):
    print("No")
else:
    print("Yes")

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

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

    index = 0
    while True:
        if index > len(s) - 1 or index > len(t) - 1:
            print('No')
            exit()
        if ord(s[index]) < ord(t[index]):
            print('Yes')
            exit()
        index += 1
        if index == min([len(s), len(t)]) and ord(s[index-1]) > ord(t[index-1]):
            print('No')
            exit()
        if index == min([len(s), len(t)]) and len(s) < len(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 = list(input())
s.sort()
t = list(input())
t.sort(reverse=True)
s_p =  "".join(s) 
t_p = "".join(t)
if s_p < t_p:
    print("Yes")
else:
    print("No")

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

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

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

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

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

print(ans)

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

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

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

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

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

def cmp(A, B):
    for i in range(min(len(A), len(B))):
        if A[i] < B[i]:
            return True

        elif A[i] > B[i]:
            return False

    if len(A) < len(B):
        return True

    return False



if cmp(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=input()
t=input()

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


if t[0:len(s)] == s:
    if len(t)>len(s):
        print("Yes")
        exit()
    else:
        print("No")
        exit()

len_s=0
for ss in s:
    for tt in t :
        if ss==tt:
            len_s+=1
            if len_s==len(s):
                print("No")
                exit()
        elif ss < tt: 
            print("Yes")
            exit()

print("No")

Solution (Python):

s=input()
t=input()

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

if s> t:
    print("No")

elif s==t:
    print("No")

else:
    print("Yes")

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


if __name__ == '__main__':
    solve()

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

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

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

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

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

u = ""
v = ""
for i in s:
    u += i
for j in t:
    v += j
if u < v:
    print("Yes")
else:
    print("No")

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

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

Solution (Python):
s=input()
S=[]
t=input()
T=[]
for i in range(len(s)):
    S.append(s[i])
for i in range(len(t)):
    T.append(t[i])
S.sort()
T.sort()
T.reverse()
for i in range(min(len(S),len(T))):
    ans=[S[i],T[i]]
    ans.sort()
    
    
    
    if ans[0]==S[i] and ans[0]!=T[i]:
        print("Yes")
        exit()


if len(set(S))==1 and len(set(T))==1:
    if len(S)<len(T):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


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


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


YNL = {False: 'No', True: 'Yes'}
YNU = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()

nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']



show_flg = False


def factorization(n):
    if n <= 1:
        return []

    ret = []
    while n > 2 and n % 2 == 0:
        ret.append(2)
        n //= 2
    i = 3
    while i <= math.sqrt(n):
        if n % i == 0:
            ret.append(i)
            n //= i
        else:
            i += 2
    ret.append(n)
    return ret


def main():
  s = S()
  t = S()
  s = ''.join(sorted([i for i in s]))
  t = ''.join(sorted([i for i in t], reverse=True))

  print(YNL[s < t])


if __name__ == '__main__':
    main()

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()

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

Solution (Python):
import sys

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

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

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

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