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

zisho = "abcdefghijklmnopqrstuvwxyz"

s_list = []
t_list = []

for i in range(len(s)):
  s_list.append(zisho.index(s[i])+1)
s_list.sort()
for i in range(len(t)):
  t_list.append(zisho.index(t[i])+1)
t_list.sort(reverse = True)

if len(s) > len(t):
  for i in range(len(s)-len(t)):
    t_list.append(0)
if len(t) > len(s):
  for i in range(len(t)-len(s)):
    s_list.append(0)

s_int = 0
t_int = 0

dif = 0

length = len(s_list)




for i in range(length):


  dif = dif + 100 ** (length-i-1) * t_list[i] - 100 ** (length-i-1) * s_list[i]




if dif > 0: print('Yes')
else: print('No')

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

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

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

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

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

    s_num = list()
    t_num = list()

    for ss in s:
        s_num.append(ord(ss))
    for tt in t:
        t_num.append(ord(tt))

    s_num.sort()
    t_num.sort(reverse=True)

    s_str = ''
    t_str = ''
    for ss in s_num:
        s_str += chr(ss)
    for tt in t_num:
        t_str += chr(tt)

    if s_str == t_str:
        print('No')
    elif min([s_str, t_str]) == s_str:
        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):
def main():
    s = sorted(input())
    t = sorted(input(), reverse=True)

    cond = s < t

    print('Yes' if cond else 'No')


if __name__ == '__main__':
    main()

Solution (Python):
S = list(map(str, input()))
T = list(map(str, 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 = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
ans = 'Yes'
n = min(len(s), len(t))
if s[:n] == t[:n]:
    if len(s) >= len(t):
        ans = 'No'
else:
    for sc, tc in zip(s, t):
        if sc == tc:
            continue
        if sc > tc:
            ans = 'No'
        else:
            ans = 'Yes'
        break
print(ans)

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

Solution (Python):
import numpy as np
import sys

input = sys.stdin.readline

s = input()
t = input()

x = sorted(s)[1:]
y = sorted(t,reverse=True)[:len(t)-1]



if x[0] < y[0]:
    print("Yes")
    exit()
else:
    if len(x) < len(y) and (x[:len(x)] == y[:len(x)]) :
        print("Yes")
        exit()
    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()
if s==t:
  print("No")
  exit(0)
a=list(s)
b=list(t)
a.sort()
b.sort(reverse=True)
a="".join(a)
b="".join(b)
l=[a,b]
l.sort()
if l[0]==a:
  print("Yes")
else:
  print("No")

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

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

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

Solution (Python):
def main():
    s = sorted(list(input()))
    t = sorted(list(input()), reverse=True)
    s = ''.join(s)
    t = ''.join(t)
    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)

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

Solution (Python):
import sys
input=sys.stdin.readline
s=sorted(input()[:-1])
t=sorted(input()[:-1])[::-1]
print("Yes" if s<t 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 heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
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 = float('inf')
mod = 10 ** 9 + 7

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

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

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

Solution (Python):
def solve():
    S = sorted(input())
    T = sorted(input(), reverse=True)
    lim = min(len(S), len(T))
    for i in range(lim):
        if (S[i]) > T[i]:
            print("No")
            break
        if S[i] == T[i]:
            continue
        else:
            print("Yes")
            break
    else:
        if len(S)<len(T):
            print("Yes")
        else:
            print("No")

if __name__ == '__main__':
    solve()

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

S = ['a']*len(s)
T = ['a']*len(t)

for i in range (0, len(s)):
	S[i]=ord(s[i])

for i in range (0, len(t)):
	T[i]=ord(t[i])

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

check = 0

for i in range (0, min(len(s), len(t))):
	if S[i] < T[i]:
		print('Yes')
		exit()
	elif S[i] == T[i]:
		check+=1

if check == min(len(S),len(t)) and len(T)>len(S):
	print('Yes')
else:
	print('No')

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

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):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s = list(readline().rstrip().decode())
t = list(readline().rstrip().decode())
s.sort()
t.sort(reverse=True)
for ss, tt in zip(s, t):
    if ss < tt:
        print('Yes')
        exit()
    if ss > tt:
        print('No')
        exit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')

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

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

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

if str(''.join(s))>=str(''.join(t)):
    print("No")
else:
    print("Yes")

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

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

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

if S == T:
    print ('No')
    exit()

lst = [S, T]

if lst == sorted(lst):
    print ('Yes')
else:
    print ('No')

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    *S,=ST()
    *T,=ST()
    S.sort()
    T.sort(reverse=True)
    S="".join(S)
    T="".join(T)
    print("YNeos"[S>=T::2])
if __name__ == '__main__':
    main()

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

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

Solution (Python):
S = list(input())
T = list(input())
S.sort()
T.sort(reverse=True)

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

Solution (Python):
if __name__ == '__main__':
    s = list(input())
    t = list(input())
    s.sort()
    t.sort(reverse=True)
    if s < 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):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
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)]

sys.setrecursionlimit(1000000)
mod = 1000000007

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


if __name__ == "__main__":
    solve()

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  


s = input()
t = input()



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

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

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


if __name__ == '__main__':
    main()

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

Solution (Python):
s = sorted(input())
t = sorted(input())
ans = False
for i in range(len(t)):
    if s < t[i:]:
        ans = True
print("Yes" if ans 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):
a = list(str(input()))
b = list(str(input()))
a.sort()
b.sort(reverse=True)
c = "".join(a)
d = "".join(b)
if c < d:
  print("Yes")
else:
  print("No")

Solution (Python):
def myAnswer(s:list,t:list) -> str:
   s.sort()
   t.sort(reverse=True)
   
   return "Yes" if(s < t) else "No"

def modelAnswer():
   return
def main():
   s = list(input())
   t = list(input())
   print(myAnswer(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 = input()
T = input()
Slis = sorted(list(S))
Tlis = sorted(list(T))[::-1]
SS = "".join(Slis)
TT = "".join(Tlis)
ans = "No"
if SS<TT:
    ans = "Yes"

print(ans)

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

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

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

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

Solution (Python):
slist=list(input())
tlist=list(input())

slist.sort()
tlist.sort(reverse=True)
if slist<tlist:
  print("Yes")
else:
  print("No")

Solution (Python):
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
s_=str()
t_=str()
for i in range(len(s)):
    s_+=s[i]
for j in range(len(t)):
    t_+=t[j]
    
dic=[s_,t_]
dic.sort()
print("Yes" if dic[0]==s_ and s!=t else "No")

Solution (Python):
s = list(input())
t = list(input())
s_len = len(s)
t_len = len(t)
min_len = min(s_len,t_len)
s.sort()
t.sort(reverse=1)

for i in range(min_len):
    if s[i] < t[i]:
        print("Yes")
        exit()
    elif s[i] > t[i]:
        print("No")
        exit()
if s_len >= t_len:
    print("No")
else:
    print("Yes")

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

Solution (Python):
s = input()
t = input()
letters_s = []
letters_t = []
for i in range(len(s)):
  letters_s.append(s[i])
letters_s.sort()
for i in range(len(t)):
  letters_t.append(t[i])
letters_t.sort(reverse=True)
ss = "".join(letters_s)
tt = "".join(letters_t)
if ss < tt:
  print("Yes")
else:
  print("No")

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

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

if sort_s < sort_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):

s=list(input())
t=list(input())
s.sort()
s=''.join(s)

t.sort()
t.reverse()
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):
F=sorted;print('NYoe s'[F(input())<F(input())[::-1]::2])

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

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

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

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

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

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

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


def log(v):
    print(v, file=sys.stderr)


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

for i in range(0, max(len(s), len(t))):
    if len(s) <= i:
        print("Yes")
        exit(0)
    if len(t) <= i:
        print("No")
        exit(0)
    if s[i] > t[i]:
        print("No")
        exit(0)
    if s[i] < t[i]:
        print("Yes")
        exit(0)
print("No")

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

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

if sorted_s < rev_sorted_t:
    print("Yes")
else:
    print("No")

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

Solution (Python):
from sys import stdin

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
def check():
    S = [s for s in input()]
    T = [t for t in input()]
    S.sort()
    S = ''.join(S)
    T.sort(reverse=True)
    T = ''.join(T)
    if S<T:
        return True
    return False
if check():
    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())
s.sort()
t.sort(reverse=True)
s2_mojiretu="".join(s)
t2_mojiretu="".join(t)
if s2_mojiretu<t2_mojiretu:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()
t=input()
s2=sorted(list(s))
t2=sorted(list(t))
s2_mojiretu="".join(sorted(s2))
t2_mojiretu="".join(reversed(t2))
if s2_mojiretu<t2_mojiretu:
    print("Yes")
else:
    print("No")

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

Solution (Python):
a=sorted(list(input()))
b=sorted(list(input()))
if "".join(sorted(a))<"".join(reversed(b)):
    print("Yes")
else:
    print("No")

Solution (Python):
s = list(map(lambda x: ord(x),list(input())))
t = list(map(lambda x: ord(x),list(input())))
s.sort()
t.sort(reverse=True)
p = len(s)
q = len(t)

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

if p >= q:
    print("No")
    exit()

print("Yes")

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

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

if '__main__' == __name__:
    resolve()

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

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

S = list(sorted(s))+['a']
T = list(sorted(t))[::-1]+['a']

ans = 'No'
for i in range(min(len(S),len(T))):
    if S[i] < T[i]:
        ans = 'Yes'
        break
    
print(ans)

Solution (Python):
a=sorted(input())
b=sorted(input())[::-1]

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

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

Solution (Python):
s=list(input())
t=list(input())
s.sort()
t.sort()
print("YNeos"[s>=t[::-1]::2])

Solution (Python):


s = input()
t = input()


ls = []
lt = []
for i in range(len(s)):
    ls.append(s[i])
for j in range(len(t)):
    lt.append(t[j])

ls.sort()
lt.sort(reverse = True)

s_min = (''.join(ls))
t_max = (''.join(lt))



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

Solution (Python):

import io

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

Solution (Python):
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)

MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)


s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
for i in range(len(s)):
    if i>len(t)-1:
        print('No')
        break
    elif s[i]>t[i]:
        print('No')
        break
    elif s[i]<t[i]:
        print('Yes')
        break
else:
    if len(t)==len(s):
        print('No')
    else:
        print('Yes')

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

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

Solution (Python):

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

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

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort()
s = "".join(s)
t = "".join(t)[::-1]
minLength = min(len(s), len(t))
for i in range(minLength):
  if ord(s[i]) > ord(t[i]):
    print("No")
    exit()
  elif ord(s[i]) < ord(t[i]):
    print("Yes")
    exit()
if minLength == len(s) and len(t) > minLength:
  print("Yes")
else:
  print("No")

Solution (Python):





s = input()
t = input()

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

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

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

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

S.sort()
T.sort(reverse=True)
S = ''.join(S)
T = ''.join(T)
order = sorted([S, T])
if order[0] == S and S != T:
    print("Yes")
else:
    print("No")

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

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



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

for i in range(length):
    if s[i] < t[i]:
        print('Yes')
        sys.exit()
    elif s[i] == t[i]:
        continue
    else:
        print('No')
        exit()
        
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 s == t:
    print("No")
    exit()
ans = [s,t]
ans2 = sorted(ans)
if ans == ans2:
    print("Yes")
else:
    print("No")

Solution (Python):
def resolve():
    s=list(input())
    t=list(input())
    s.sort()
    t.sort()
    t.reverse()
    if s>=t:
        print("No")
    else:
        print("Yes")
resolve()

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

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

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

Solution (Python):

a = input()
a_asc = ''.join(sorted(a))

b = input()
b_desc = ''.join(sorted(b, reverse=True))

if a_asc < b_desc:
	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())


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

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

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

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


s.sort()
t.sort(reverse = True)
ok = "".join(s) < "".join(t)
if len(s) < len(t):ok |=k
if ok:print('Yes')
else:print('No')

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

Solution (Python):

s, t = [list(input()) for _ in range(2)]
s.sort()
t.sort()
t.reverse()

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

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

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

Solution (Python):
s = input()
t = input()
S = []
T = []
for i in range(len(s)):
    S.append(s[i])
for j in range(len(t)):
    T.append(t[j])
S.sort()
T.sort()
T.reverse()
a = ''
b = ''
for i in range(len(s)):
    a += S[i]
for j in range(len(t)):
    b += T[j]
if a < b:
    print('Yes')
else:
    print('No')

Solution (Python):
s = sorted(list(str(input())))
t = reversed(sorted(list(str(input()))))
S = str()
T = str()
for i in s:
    S += i
for k in t:
    T += k
print('Yes' if S<T else 'No')

Solution (Python):
s = sorted(list(str(input())))
t = reversed(sorted(list(str(input()))))
S = str()
T = str()
for i in s:
    S += i
for k in t:
    T += k
print('Yes' if S<T else 'No')

Solution (Python):
s = sorted(list(str(input())))
t = reversed(sorted(list(str(input()))))
S = str()
T = str()
for i in s:
    S += i
for k in t:
    T += k
print('Yes' if S<T else 'No')

Solution (Python):
s = sorted(list(str(input())))
t = reversed(sorted(list(str(input()))))
S = str()
T = str()
for i in s:
    S += i
for k in t:
    T += k
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 = sorted(input())
t = sorted(input(), reverse = True)

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

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

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

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

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

Solution (Python):
import sys

s=input()
t=input()
s1,t1="",""

for i in range(len(s)):
  if i!=0:
    if s1[0]>=s[i]:
      s1=s[i]+s1
    
    else:
      s1+=s[i]
      
  else:
    s1=s[i]
    
for i in range(len(t)):
  if i!=0:
    if t1[0]<=t[i]:
      t1=t[i]+t1
    
    else:
      t1+=t[i]
      
    if t1>s1:
      print("Yes")
      sys.exit()
      
  else:
    t1=t[i]
    
print("No")

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

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

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

Solution (Python):
import sys

s=input()
t=input()
s1,t1="",""

for i in range(len(s)):
  if i!=0:
    if s1[0]>=s[i]:
      s1=s[i]+s1
    
    else:
      s1+=s[i]
      
  else:
    s1=s[i]
    
for i in range(len(t)):
  if i!=0:
    if t1[0]<=t[i]:
      t1=t[i]+t1
    
    else:
      t1+=t[i]
      
    if t1>s1:
      print("Yes")
      sys.exit()
      
  else:
    t1=t[i]
    
print("No")

Solution (Python):
s = sorted(input())
t = sorted(input(),reverse=True)
ss=''
tt=''
for i in s:
    ss += i
for i in t:
    tt += i

if (ss < tt):
    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 = str(input())
t = str(input())
sl = list()
for S in s:
    sl.append(S)
tl = list()
for T in t:
    tl.append(T)
sl.sort()
tl.sort()
tl.reverse()
l = [''.join(sl), ''.join(tl)]
l.sort()
if l[0]!=l[1]:
    print('Yes' if ''.join(sl) == l[0] else 'No')
else:
    print('No')

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

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