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

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

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

s = list(map(lambda x : ord(x), s))
t = list(map(lambda x : ord(x), t))

i = 0
while i < min(len(s), len(t)):
    if s[i] < t[i]:
        print('Yes')
        break
    elif s[i] == t[i]:
        i += 1
    else:
        print('No')
        break
if i == min(len(s), len(t)):
    if len(s) < len(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):
hoge=list(input())
huga=list(input())
hoge.sort()
huga.sort(reverse=True)
flag=0

for i in range(min(len(hoge),len(huga))):
  if(hoge[i]>huga[i]):
    flag=1
    break
  elif(hoge[i]<huga[i]):
    flag=-1
    break

if(flag==0):
  if(len(hoge)>=len(huga)):
    flag=1
    
    
if(flag==1):
  print("No")
else:
  print("Yes")

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

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

Solution (Python):


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

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

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

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

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

size = min(len(s), len(t))
result = ""

for i in range(size):
    if s[i] < t[i]:
        result = "Yes"
        break

if result == "":
    if s[0:size] == t[0:size]:
        if len(s) < len(t):
            result = "Yes"
        else:
            result = "No"
    else:
        result = "No"

print(result)

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

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

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



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

sss = "".join(ss)
ttt = "".join(tt)


A = [sss, ttt]
A.sort()

if A[0] == sss:
	print("Yes")
else:
	print("No")

Solution (Python):
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t)
t.reverse()
t = "".join(t)
s = "".join(s)
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):
sl = list(input())
tl = list(input())

print('Yes') if ''.join(sorted(sl)) < ''.join(sorted(tl, reverse=True)) else print('No')

Solution (Python):
from sys import stdin
s = list(stdin.readline().rstrip())
t = list(stdin.readline().rstrip())
s.sort()
t.sort(reverse=True)
if s < t:
    print('Yes')
else:
    print('No')

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

Solution (Python):

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

Solution (Python):
s = str(input())
t = str(input())
 
s_ = list(s)
t_ = list(t)
 
s_.sort()
t_.sort(reverse = True)
 
s_sorted = ""
for S in s_:
  s_sorted += S
 
t_sorted =""
for T in t_:
  t_sorted += T
 
if s_sorted < t_sorted:
  print('Yes')
  
else:
  print('No')

Solution (Python):
def solve(string):
    s, t = string.split()
    return "Yes" if sorted(s) < sorted(t,reverse=True) else "No"


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

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

Solution (Python):
def dic(s):
  dics,ans=[],""
  for i in range(len(s)):dics.append(s[i])
  dics.sort()
  for i in dics:ans+=i
  return ans
print("Yes"if dic(input())<dic(input())[::-1]else"No")

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

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

Solution (Python):
s = 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())
s.sort()

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

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

Solution (Python):


s = list(input())
t = list(input())
s1 = sorted(s)
t1 = sorted(t, reverse=True)
print('Yes' if s1 < t1 else 'No')

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

Solution (Python):
x = input()
y = sorted(input())
x1 = ''.join(sorted(x))
y1 = ''.join(list(reversed(y)))
if x1 < y1:
    print('Yes')
else:
    print('No')

Solution (Python):
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = [i for i in S()]
t = [i for i in S()]
f = 0
if len(s)<len(t):
    f = len(s)
s.sort()
t.sort(reverse=True)
for a,b in zip(s,t):
    if a < b:
        print("Yes")
        exit()
    elif a == b:
        f -= 1
if f == 0:
    print("Yes")
else:
    print("No")

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

Solution (Python):
a = list(input())
b = list(input())
for i in range(len(a)-1):
    for j in range(len(a)-i-1):
        if a[j] >= a[j+1]:
            a[j],a[j+1] = a[j+1],a[j]
for i in range(len(b)-1):
    for j in range(len(b)-i-1):
        if b[j] >= b[j+1]:
            b[j],b[j+1] = b[j+1],b[j]
a_string = ''.join(a)
b_string = ''.join(b[::-1])
if a_string < b_string:
    print('Yes')
else:
    print('No')

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

def histgram(s):
    h = {}
    for i in range(26):
        ch = chr(i + ord('a'))
        h[ch] = 0
    for ch in s:
        h[ch] += 1
    return h
h_s = histgram(s)
h_t = histgram(t)
s_ = ""
for i in range(26):
    ch = chr(i + ord('a'))
    for j in range(h_s[ch]):
        s_ += ch
t_ = ""
for i in range(25, -1, -1):
    ch = chr(i + ord('a'))
    for j in range(h_t[ch]):
        t_ += ch
ans = s_ < t_

print("Yes" if ans else "No")

Solution (Python):
from sys import exit
import math


S = list(input())
T = list(input())
S = "".join(sorted(S))
T = "".join(sorted(T)[::-1])
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,t=[str(input()) for i in range(2)]
print('Yes') if ''.join(sorted(list(s))) < ''.join(sorted(list(t)))[::-1] else print('No')

Solution (Python):
x=list(input())
y=list(input())
x.sort();y.sort(reverse=True)
''.join(x);''.join(y)

if x<y:
  print('Yes')
else:
  print('No')

Solution (Python):
s=input()
t=input()
ss=[]
st=[]
for i in (s):
    ss.append(i)
for i in (t):
    st.append(i)
ss.sort()
st.sort(reverse=True)
ans='No'

if ''.join(ss)<''.join(st):
    ans='Yes'

print(ans)

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

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

Solution (Python):
S = sorted(input())
N = sorted(input())
N.reverse()
print("Yes" if S < N  else "No")

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

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

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

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

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

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

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

t = input()

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

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

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

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

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

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

Solution (Python):


import itertools
import collections
import bisect

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



if __name__ == '__main__':
    main()

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

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

s = sorted(s)
t = sorted(t)
t.reverse()

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

Solution (Python):
def two_anagrams(s: str, t: str) -> bool:
    '''s を並び替えた実現可能な最小の文字列 s' と t を並び替えて
    実現可能な最小の文字列 t' に関して、s' < t' が成り立てば良い。
    '''
    sn, tn = len(s), len(t)
    sd, td = sorted(s), sorted(t, reverse=True)

    idx = 0
    while idx < sn and idx < tn:
        
        if sd[idx] < td[idx]:
            
            return True
        if sd[idx] == td[idx]:
            
            idx += 1
            continue
        if sd[idx] > td[idx]:
            
            return False

    
    return sn < tn


if __name__ == "__main__":
    s = input()
    t = input()
    yes = two_anagrams(s, t)
    print('Yes' if yes else 'No')

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

Solution (Python):
n = list(input())
m = list(input())
n.sort()
m.sort(reverse = True)
n = "".join(n)
m = "".join(m)
if m > n:
    print("Yes")
else:
    print("No")

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

Solution (Python):

from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return list(sys.stdin.readline())
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 LSR(n): return [LS() for i in range(n)]
mod = 1000000007
 

"""
a, b = LI()
print((a+b+1)//2)
"""
 

a = S()
a = a[:-1]
b = S()
b = b[:-1]
a.sort()
b.sort(reverse=True)
if a < b:
    print("Yes")
else:
    print("No")

Solution (Python):

from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return list(sys.stdin.readline())
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 LSR(n): return [LS() for i in range(n)]
mod = 1000000007


"""
a, b = LI()
print((a+b+1)//2)
"""


a = S()
a = a[:-1]
b = S()
b = b[:-1]
a.sort()
b.sort(reverse=True)
if a < b:
    print("Yes")
else:
    print("No")

Solution (Python):
import math

def A():
    a, b = [int(x) for x in input().split()]
    print(math.ceil((a + b)/2))

def B():
    a = ''.join(sorted(list(input()), key=lambda x:ord(x)))
    b = ''.join(sorted(list(input()), key=lambda x:-ord(x)))
    if a < b:
        print('Yes')
    else:
        print('No')

B()

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

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007


def A():
    a,b = LI()
    print(math.ceil((a+b)/2))


def B():
    s = S()
    t = S()
    s.sort()
    t.sort()
    t = t[::-1]
    l = [s,t]
    l.sort()
    if s == t:
        print("No")
    elif l[0] == s:
        print("Yes")
    else:
        print("No")

def C():
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == "__main__":
    B()

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    s = [str(c) for c in input().strip()]
    t = [str(c) for c in input().strip()]

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

    S = ''
    for c in s:
        S += c
    T = ''
    for c in t:
        T += c

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


if __name__ == '__main__':
    main()

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

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

s_ = "".join(s_)
t_ = "".join(t_)

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

Solution (Python):

import collections

s = str(input())
t = str(input())
sd = list(s)
td = list(t)
sd.sort()
td.sort(reverse=True)
a = ''
b = ''
for c in sd:
    a += c
for c in td:
    b += c
if sd < td:
    print('Yes')
else:
    print('No')

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

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

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

Solution (Python):
s1 = input()
t1 = input()

s2 = sorted(s1)
t2 = sorted(t1,reverse=True)

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

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

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
alphabet = list('@abcdefghijklmnopqrstuvwxyz')

judge = -1 

if(len(s)>len(t)):
 for i in range(len(s)-len(t)):
   t.append('@')
elif(len(s)<len(t)):
 for i in range(len(t)-len(s)):
   s.append('@')

len0 = len(s)
count = 0
while(len(s) > 0):
  a = alphabet.index(s[0])
  b = alphabet.index(t[0])
  if(a < b):
    judge = 0 
    break
  elif(a == b):
    count += 1
  else:
    judeg = -1
    break 
  s.pop(0)
  t.pop(0)
  
if((judge == -1)or(count == len0)):
  print('No')
else:
  print('Yes')

Solution (Python):
s=list(input())
t=list(input())
s.sort()
t.sort()
print("Yes" if s<t[::-1] 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 = input()
t = input()

S = []
T = []
for i in s:
    S.append(i)
S.sort()
for i in t:
    T.append(i)
    T.sort(reverse = True)

Sstring = "".join(S)
Tstring = "".join(T)
print("Yes" if Sstring < Tstring else "No")

Solution (Python):

A = sorted(list(map(ord, list(input()))))
B = sorted(list(map(ord, list(input()))), reverse=True)
ans = 'No'
for i in range(min(len(A), len(B))):
    if A[i] < B[i]:
        ans = 'Yes'
        break
    elif A[i] > B[i]:
        break
    if i == len(A) - 1 and len(A) != len(B):
        ans = 'Yes'
print(ans)

Solution (Python):
s=input()
t=input()
s="".join(sorted(s))
t="".join(sorted(t,reverse=True))
print("Yes") if s<t 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()
flag=0
for i in s:
    for j in t:
        if i<j:
            flag=1
            break
            
if flag :
    print("Yes")
elif s.count(s[0])==len(s) and t.count(s[0])==len(t) and len(s)<len(t):
    print("Yes")
else:
    print("No")

Solution (Python):
s=sorted([i for i in input()])
t=list(reversed(sorted([i for i in input()])))
str_s=""
str_t=""
for i in s:
    str_s+=i
for i in t:
    str_t+=i
print("Yes" if str_s<str_t else "No")

Solution (Python):
s=input()
t=input()
S=list(s)
S.sort()
x=''.join(S)
T=list(t)
T.sort(reverse=True)
y=''.join(T)

A=[x,y]

A.sort()

if A[0]==x and x!=y:
    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 = 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.sort()
t.sort(reverse = True)
if len(s) < len(t):
    if s <= t[:len(s)]:
        print("Yes")
    else:
        print("No")
else:
    if s < t:
        print("Yes")
    else:
        print("No")

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

if s[0] < t[len(t)-1]:
    print('Yes')
elif s[0] > t[len(t)-1]:
    print('No')
elif len(s) < len(t):
    for i in range(len(s)):
        if s[i] != t[i]:
            print('No')
            break
        elif i == len(s)-1:
            print('Yes')
else:
    print('No')

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

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

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

A = "abcdefghijklmnopqrstuvwxyz"
B = {}
for i in range(26) :
    B[A[i]] = i

S = []
for i in range(len(s)) :
    S.append(B[s[i]])
T = []
for i in range(len(t)) :
    T.append(B[t[i]])
S.sort()
T.sort(reverse=1)


i = 0
while i < len(s) and i < len(t) and S[i] == T[i] :
    i += 1

if i == len(t) and len(s) >= len(t) :
    no = 1
elif i <= len(s)-1 and  S[i] > T[i] :
    no = 1
if no == 1 :
    print("No")
else :
    print("Yes")

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,t = map(str, [input() for i in range(2)])

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


def XY(x, y):
    x.sort()
    y.sort(reverse=True)
    c = 0
    D = True
    while c < len(x) and c < len(y):
        if x[c] < y[c]:
            break
        elif x[c] == y[c]:
            c += 1
        elif x[c] > y[c]:
            D = False
            break
        if len(x) >= len(y) and c == len(y)-1 and x[c] >= y[c]:
            D = False


    return D

Result = XY(S, T)

if Result:
    print('Yes')
else:
    print('No')

Solution (Python):
s, t = [input() for _ in range(2)]
s1, t1 = "", ""
for l in sorted(s):
    s1 += l
for l in sorted(t, reverse=True):
    t1 += l
print("Yes") if s1 < t1 else print("No")

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

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

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

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

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

Solution (Python):

"""
Created on Mon Feb 25 00:39:05 2019

@author: yuta
"""

def dic(n,m):
    x = ''.join(sorted(n))
    y = ''.join(sorted(m,reverse = True))
    if x < y:
        print("Yes")
    else:
        print("No")
dic(input(),input())

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

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

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

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

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

Solution (Python):
s=sorted(list(input()))
t=sorted(list(input()),reverse=True)
s2=""
t2=""
for x in s:
    s2+=x
for y in t:
    t2+=y
if s2==t2:
    print("No")
    exit()
c=sorted([s2,t2])
if c[0]==s2:
    print("Yes")
else:
    print("No")

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

Solution (Python):



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


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



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

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

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

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

Solution (Python):

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

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

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

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

s_ = ''
t_ = ''

for i in s:
    s_ += i
for i in t:
    t_ += i

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

Solution (Python):
s = input()
t = input()
new_s = sorted(s)
new_t = sorted(t, reverse = True)
if new_s < new_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 copy
import numpy as np
import random

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

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


ans = False
min_str = min(len(s),len(t))
for i in range(min_str):
    if s[i]==t[i]:
        if min_str-1 == i and len(t)>len(s):
            ans = True
    elif s[i]>t[i]:
        ans = False
        break
    else:
        ans = True
        break

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

Solution (Python):
import sys


def main(s, t):
    s_ = ''
    for i in sorted(s):
        s_ += i

    t_ = ''
    for i in sorted(t, reverse=True):
        t_ += i

    if s_ < t_:
        return 'Yes'
    else:
        return 'No'


if __name__ == '__main__':
    _s = input()
    _t = input()
    ret = main(_s, _t)
    print(ret)

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

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

sl = [s[i] for i in range(0,len(s))]
tl = [t[i] for i in range(0,len(t))]
slsort = sorted(sl)
tlreversesort = sorted(tl, reverse=True)




if slsort < tlreversesort:
    print('Yes')
else:
    print('No')

Solution (Python):
s=input();t=input()
s=sorted(s)
t=sorted(t)
tnew=[]

for i in range(len(t)-1,-1,-1):
    
    tnew.append(t[i])
cnt=0

if len(s)<=len(t):
    L=len(s)
else:
    L=len(t)


for i in range(L):
    if s[i]<tnew[i]:
        print('Yes')
        cnt=1
        break
    if s[i]>tnew[i]:
        print('No')
        cnt=1
        break

if cnt==0:
    if len(tnew)>len(s):
        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 = input()
t = input()

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

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

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

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

if new_s < new_t:
    print("Yes")
else:
    print("No")

Solution (Python):
""" AtCoder """

s = input()
t = input()

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

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 = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
for i,j in zip(s,t):
  if i > j:
    print("No")
    exit()
  elif i < j:
    print("Yes")
    exit()
len_s = len(s)
len_t = len(t)
if len(s) >= len(t):
  print("No")
else:
  print("Yes")

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

Solution (Python):
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())















x = input()
y = input()
a = []
b = []
for i in range(len(x)):
    a.append(x[i])
for i in range(len(y)):
    b.append(y[i])
a.sort()
b.sort(reverse=True)
j(''.join(a) < ''.join(b))

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

str_s_d = sorted(str_s)
str_t_d = sorted(str_t, reverse=True)

if str_s_d < str_t_d:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
t = input()
slist = []
tlist = []
for i in s:
    slist.append(ord(i))
for i in t:
    tlist.append(ord(i))

slist.sort()
tlist.sort(reverse=True)

while True:
    if not slist and not tlist:
        print('No')
        exit(0)
    elif not tlist:
        print('No')
        exit(0)
    elif not slist:
        print('Yes')
        exit(0)

    spop = slist.pop(0)
    tpop = tlist.pop(0)

    if spop == tpop:
        pass
    elif spop > tpop:
        print('No')
        exit(0)
    else:
        print('Yes')
        exit(0)

Solution (Python):

s = [i for i in input()]
s.sort()
s ="".join(s)
t = [i for i in input()]
t.sort(reverse = True)
t ="".join(t)

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

Solution (Python):
a=sorted(input())
b=sorted(input())[::-1]
if a<b:
  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 = ''.join(sorted(input()))
t = ''.join(sorted(input(), reverse=True))

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

Solution (Python):
s=input()
t=input()
ok=False
snum=[]
tnum=[]
for i in range(len(s)):
    snum.append(ord(s[i]))
snum.sort()
for i in range(len(t)):
    tnum.append(ord(t[i]))
tnum.sort(reverse=True)
if len(s)>=len(t):
    round=len(t)
else:
    round=len(s)
for i in range(round):
    if (snum[i]<tnum[i]) or (snum==tnum[:round]and len(t)>len(s)):
        ok=True
        break
print("Yes"if ok 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()))[::-1]
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):
s=sorted(list(input()))
t=sorted(list(input()))[::-1]
for i in range(min(len(s),len(t))):
  if(s[i]<t[i]):
    print('Yes')
    break
  elif(s[i]>t[i]):
    print('No')
    break
  else:
    if(i<min(len(s)-1,len(t)-1)):pass
    else:
      if(len(s)<len(t)):
        print('Yes')
        break
      else:
        print('No')
        break

Solution (Python):
s=list(input())
s.sort()
t=list(input())
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):
s=input()
t=input()
sl = [s[i] for i in range(len(s))]
tl = [t[i] for i in range(len(t))]
n = len(sl)
m = len(tl)
sl.sort()
tl.sort(reverse=True)
s_ans = ''.join(sl)
t_ans = ''.join(tl)
if s_ans < t_ans:
    print("Yes")
else:
    print("No")

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

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

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

Solution (Python):
s, t = input(), input()
n = max(len(s), len(t))
a = sorted(map(ord, s))+[0]*(n-len(s))
b = sorted(map(ord, t), reverse=True)+[0]*(n-len(t))
for k, l in zip(a, b):
    if k < l:
        print("Yes")
        break
    if k > l:
        print("No")
        break
else:
    print("No")

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

Solution (Python):
print("Yes" if sorted([c for c in input()])<sorted([c for c in input()],reverse=1) else "No")

Solution (Python):
a,b=input(), input()
aa=[A for A in a]
aa.sort()
bb=[B for B in b]
bb.sort(reverse=1)
print("No" if aa>=bb else "Yes")

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