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

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

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

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

if sss < ttt:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys
s = sys.stdin.readline().rstrip("\n")
t = sys.stdin.readline().rstrip("\n")
s_ = sorted(s)
s_ = ''.join(s_)
t_ = sorted(t, reverse=True)
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)

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

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

Solution (Python):
s = sorted(map(str, input()))
t = sorted(map(str, input()))
if len(set(s)) == len(set(t)) == 1:
    if len(s) < len(t):
        print('Yes')
    else:
        print('No')
else:
    if ord(s[0]) < ord(t[-1]):
        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):
S = input()
T = input()

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

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

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

s.sort()
t.sort()
t = t[::-1]

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

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

Solution (Python):
def sort_words(s, reverse=False):
    s = sorted(s, reverse=reverse)
    return ''.join(s)


s = sort_words(input())
t = sort_words(input(), True)
print('Yes' if s < t else 'No')

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

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

list = sorted([s, t])
print('Yes' if (s == list[0] and s != t) else 'No')

Solution (Python):
s = input()
t = input()
s = sorted(s)
t = sorted(t,reverse = True)
S = "".join(s)
T = "".join(t)
L = [S,T]
L = sorted(L)
if L[0] == S:
    if L[0] == L[1]:
        print("No")
    else:
        print("Yes")
else:
    print("No")

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

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

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

Solution (Python):
S = ''.join(sorted(list(input())))
T = ''.join(reversed(sorted(list(input()))))

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

Solution (Python):

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

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

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

Solution (Python):

s = input()
t = input()


s_sort = "".join(sorted(s))
t_sort = "".join(sorted(t,reverse=True))

print("Yes" if s_sort < t_sort 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):
s1 = input()
s2 = input()
sorted_s1 = ''.join(sorted(s1))
sorted_s2 = ''.join(sorted(s2,reverse=True))
if sorted_s1 < sorted_s2:
  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
import math
import bisect
import re

def solve():
    s = input()
    t = input()
    s = ''.join(sorted(s))
    t = ''.join(sorted(t, reverse=True))
    return s < t

def main():
    if solve():
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()

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

Solution (Python):
s = input()
t = input()
s0 = sorted([c for c in s])
t0 = sorted([c for c in t], reverse=True)
if s0 < t0:
  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 = ''.join(sorted(list(input())))
t = ''.join(sorted(list(input()), reverse=True))

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

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

Solution (Python):
s = sorted([i for i in input()])
t = sorted([j for j in input()], reverse=True)

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

Solution (Python):
s=input()
t=input()
l_s=len(s)
l_t=len(t)

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

cnt=0

if l_s<=l_t:
    for i in range(l_s):
        if ord(s[i])<ord(t[i]):
            print("Yes")
            exit()
        elif ord(s[i])>ord(t[i]):
            print("No")
            exit()
        else:
            cnt+=1

    if cnt==l_s==l_t:
        print("No")
    else:
        print("Yes")

else:
    for i in range(l_t):
        if ord(s[i])<ord(t[i]):
            print("Yes")
            exit()

        elif ord(s[i])>ord(t[i]):
            print("No")
            exit()

    print("No")

Solution (Python):
s=input()
t=input()
l_s=len(s)
l_t=len(t)

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

cnt=0

if l_s<=l_t:
    for i in range(l_s):
        if ord(s[i])<ord(t[i]):
            print("Yes")
            exit()
        elif ord(s[i])>ord(t[i]):
            print("No")
            exit()
        else:
            cnt+=1

    if cnt==l_s==l_t:
        print("No")
    else:
        print("Yes")

else:
    for i in range(l_t):
        if ord(s[i])<ord(t[i]):
            print("Yes")
            exit()

        elif ord(s[i])>ord(t[i]):
            print("No")
            exit()

    print("No")

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

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

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    s=list(input())
    t=list(input())
    s.sort()
    t.sort(reverse=1)
    l=[s,t]
    l.sort()
    YesNo(l[0]==s and s!=t)

if __name__ == '__main__':
    main()

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

Solution (Python):


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

    list_s = []
    list_t = []

    for char in s:
        list_s.append(char)
    
    for char in t:
        list_t.append(char)
    
    if ''.join(sorted(list_s)) < ''.join(sorted(list_t)[::-1]):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
s = list(input())
t = list(input())
s_uni = sorted([ord(i) for i in s])
t_uni = sorted([ord(i) for i in t], reverse = True)
for i in range(min(len(s), len(t))):
    if s_uni[i] < t_uni[i]:
        print('Yes')
        exit()
    elif s_uni[i] == t_uni[i]:
        continue
    else:
        print('No')
        exit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
s_list = [s[i] for i in range(len(s))]
t = input()
t_list = [t[i] for i in range(len(t))]
s_list.sort()
t_list.sort(reverse=True)
n = min(len(s), len(t))

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

    else:
        print('No')
        exit(0)

Solution (Python):
s = sorted(input())
t = sorted(input())[::-1]
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()
S=[]
T=[]
for i in range(len(s)):
  S.append(s[i])
S=sorted(S)
for i in range(len(t)):
  T.append(t[i])
T=sorted(T,reverse=True)
print('Yes' if S<T else 'No')

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

t.sort()
t.reverse()
if (s[0]<t[0]):
    print("Yes")
else:
    if(len(s)<len(t)):
        flag = 0
        for i in range(1,len(s)):
            if (s[i-1]!=s[i]):
                flag += 1
        for j in range(1,len(t)):
            if (t[j-1]!=t[j]):
                flag += 1
        if (flag == 0):
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Solution (Python):




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


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

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

if strs < strt:
    print("Yes")
else:
    print("No")

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

Solution (Python):

alpha2num = lambda c: ord(c) - ord('a') + 1

s = input()
t = input()

s_indexs = []
t_indexs = []

for i in range(len(s)):
    s_indexs.append(alpha2num(s[i]))

for i in range(len(t)):
    t_indexs.append(alpha2num(t[i]))

s_indexs.sort()
t_indexs.sort(reverse = True)

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

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

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

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

print("Yes" if s2 < t2 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 = input()
t = input()

s = ''.join(sorted(s))
t = ''.join(sorted(t, reverse=True))
sort = sorted([s, t])
if s == t:
    print('No')
elif sort[0] == s:
    print('Yes')
else:
    print('No')

Solution (Python):
s = list(input())
t = list(input())
s.sort()
s2 = ''.join(s)
t.sort(reverse=True)
t2=''.join(t)
print('Yes') if s2<t2 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):
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions

import copy





sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))




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

    s_ord = [ord(i) for i in s]
    t_ord = [ord(i) for i in t]
    s_ord.sort()
    t_ord.sort(reverse=True)

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

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions

import copy





sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))




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

    s_ord = [ord(i) for i in s]
    t_ord = [ord(i) for i in t]
    s_ord.sort()
    t_ord.sort(reverse=True)

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

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


if __name__ == '__main__':
    main()

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

sd = ""
td = ""

for i in range(len(s)):
    a = 0
    for j in range(len(s)):
        if s[j] < s[a]:
            a = j
    sd = sd + s.pop(a)

for i in range(len(t)):
    a = 0
    for j in range(len(t)):
        if t[a] < t[j]:
            a = j
    td = td + t.pop(a)

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

Solution (Python):
s=list(input())
t=list(input())
N=len(s)
M=len(t)

s.sort()
t.sort(reverse=True)
for i in range(min(N,M)):
    if t[i]>s[i]:
        print("Yes")
        exit()
    elif t[i]<s[i]:
        print("No")
        exit()
    else:
        continue

if N<M:
    print("Yes")
else:
    print("No")

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

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

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

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

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

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

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

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

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

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

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

s_length = len(s)
t_length = len(t)

w1 = ''
w2 = ''

for a in range(0, s_length):
    w1 += s.pop(0)

for a in range(0, t_length):
    w2 += t.pop(0)

if w1 < w2:
    print('Yes')
else:
    print('No')

Solution (Python):
s = list(input())
s_ = sorted(s)
t = list(input())
t_ = sorted(t,reverse=True)
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=sorted(input())
t=sorted(input(),reverse=True)
ans='Yes'
for i in range(min(len(s),len(t))):
    if ord(s[i])<ord(t[i]):
        break
    elif ord(s[i])==ord(t[i]):
        ans='UN'
        continue
    else:
        ans='No'
        break
if ans=='UN':
    if len(t)>len(s):
        ans='Yes'
    else:
        ans='No'
print(ans)

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

t = list(input())

s.sort(reverse = False)

t.sort(reverse = True)

k = [s,t]

k.sort()

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

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

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

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

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

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

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

    S = ','.join(s)
    T = ','.join(t)

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

if __name__ == '__main__':
    main()

Solution (Python):

import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi

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

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

ss = ''.join(sorted([c for c in s]))
ts = ''.join(sorted([c for c in t], reverse=True))

print('Yes' if ts > ss else 'No')

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

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

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


for a, b in zip(s_, t_):
    if a == b:
        continue
    elif a > b:
        print('No')
        exit()
    else:
        print('Yes')
        exit()

if N < M:
    print('Yes')
else:
    print('No')

Solution (Python):

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

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

Solution (Python):
s = sorted(input())
t = sorted(input())[::-1]

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

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

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

for item in zip(s,t):
    if ord(item[0]) < ord(item[1]):
        print('Yes')
        exit()
    elif ord(item[0]) > ord(item[1]):
        print('No')
        exit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')

Solution (Python):
def resolve():
    '''
    code here
    '''
    s = [item for item in input()]
    t = [item for item in input()]

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


    if rs < rt:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    resolve()

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

Solution (Python):
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")

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

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

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

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

if sorted([s,t])[0] == s and 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
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7


s=input().rstrip()
t=input().rstrip()
u=sorted(list(s))
v=sorted(list(t),reverse=True)

ss=""
tt=""
for i in u:
    ss+=i
for j in v:
    tt+=j


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

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

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


s.sort()
t.sort()
ti = t[::-1]
ss = ''.join(s)
tt = ''.join(ti)
tmp = []
tmp.append(ss)
tmp.append(tt)
tmp.sort()
if tmp[0] == ss and ss != tt:
    print('Yes')
else:
    print('No')

Solution (Python):
s=input()
t=input()
s_=sorted(s)
t_=sorted(t,reverse=True)
A=[]
A.append(s_)
A.append(t_)
B=sorted(A)
if B[0]==s_ and B[0]!=B[1]:
  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):
from collections import Counter
s = input()
t = input()
s_cnt = sorted(Counter(s).most_common())
t_cnt = sorted(Counter(t).most_common())[::-1]
s_replaced = ""
t_replaced = ""
for k, v in s_cnt:
    s_replaced += k * v 
for k, v in t_cnt:
    t_replaced += k * v 

def judge(s, t):
    for i in range(min(len(s), len(t))):
        if ord(s[i]) > ord(t[i]):
            return False
        if ord(s[i]) < ord(t[i]):
            return True
    if len(s) < len(t):
        return True
    else:
        return False

if judge(s_replaced, t_replaced):
    print("Yes")
else:
    print("No")

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

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

Solution (Python):
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    s =     _in[0]   
    t =     _in[1]   
    
    s_arr = [_s for _s in s]
    t_arr = [_t for _t in t]
    s_arr.sort()
    t_arr.sort(reverse=True)
    s = ''.join(s_arr)
    t = ''.join(t_arr)
    if s==t:
        TF = 'Yes' if len(s)<len(t) else 'No'
    else:
        TF = 'Yes' if s<t else 'No'
    
    print(TF)

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

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

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
for ss, tt in zip(s, t):
    if ss<tt:
        print('Yes')
        break
    elif ss>tt:
        print('No')
        break
else:
    if len(s)<len(t):
        print('Yes')
    else:
        print('No')

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

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

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

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

if __name__ == '__main__':
    main()

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

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

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

Alpha = ['0', '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']

while len(s) != len(t):
    if len(s) > len(t):
        t.append('0')
    else:
        s.append('0')

for i in range(len(s)+1):
    if i == len(s):
        print('No')
    elif Alpha.index(s[i]) < Alpha.index(t[i]):
        print('Yes')
        break
    elif Alpha.index(s[i]) > Alpha.index(t[i]):
        print('No')
        break
    else:
        continue

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

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

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

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

Solution (Python):
s = list(input())
t = list(input())
s = "".join(sorted(s))
t = "".join(sorted(t, 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("No")
else:
    str_list = ["".join(s), "".join(t)]

    sorted_str_list = sorted(str_list)

    if str_list[0] == sorted_str_list[0]:
        print("Yes")
    else:
        print("No")

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
s2 = ""
t2 = ""
for i in range(len(s)):
    s2+=s[i]
for i in range(len(t)):
    t2+=t[i]
dic = [s2,t2]
dic.sort() 
if s2 == t2:
    print("No")
    sys.exit()   
if dic[0] == s2:
    print("Yes")
else:
    print("No")

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

n = min(len(s),len(t))
A = "No"
if s[0:n] == t[0:n] and len(s)<len(t):
  print("Yes")
  exit()
for i in range(n):
  if s[i] < t[i]:
    print("Yes")
    exit()
  
print(A)

Solution (Python):
A=list(input())
B=list(input())
A.sort()
B.sort(reverse=True)
C = [A,B]
C.sort()
if "".join(B) == "".join(C[1]) and A != B:
    print("Yes")
else:
    print("No")

Solution (Python):
a=list(input())
b=list(input())
a.sort()
b.sort(reverse=True)

i=0
while a[i] == b[i] and i<min(len(a),len(b))-1:
    i+=1


if a[i]<b[i] or (a[i]==b[i] and len(a)<len(b)):
    print('Yes')
else:
    print('No')

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

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

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

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

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

Solution (Python):
s = sorted(input())
t = sorted(input())[::-1]

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

Solution (Python):
s = input()
t = input()
s = sorted(s)
t = sorted(t,reverse=True)
S = [ord(s[i]) for i in range(len(s))]
T = [ord(t[i]) for i in range(len(t))]
l = 0
if len(S) < len(T):
  for i in range(len(S)):
    if S[i] < T[i]:
      print('Yes')
      break
    elif S[i] >T[i]:
      print('No')
      break
    else:
      l += 1
  if l == len(S):
    print('Yes') 
else:
  for i in range(len(T)):
    if S[i] < T[i]:
      print('Yes')
      break
    elif S[i] >T[i]:
      print('No')
      break
    else:
      l += 1
  if l == len(T):
    print('No')

Solution (Python):


s = [i for i in input()]
t = [i for i in input()]

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

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

ans = [(s, 0), (t, 1)]
ans.sort()
if s == t:
    print('No')
elif ans[0][1] == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys

def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))

INIT_VAL = 0
def DD2(d1,d2): return [[INIT_VAL]*d2 for _ in range(d1)]
def DD3(d1,d2,d3): return [DD2(d2,d3) for _ in range(d1)]

MOD=10**9+7
def divc(x,y): return -(-x//y)
def divf(x,y): return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers"""
    is_prime = [True] * MAX_NUM
    is_prime[0] = False
    is_prime[1] = False
    primes = []
    for i in range(MAX_NUM):
        if is_prime[i]:
            primes.append(i)
            for j in range(2*i, MAX_NUM, i):
                is_prime[j] = False
    return primes

from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left



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


if __name__ == '__main__':
    main()

Solution (Python):
def resolve():
    
    n = sorted(input())
    m = sorted(input(), reverse=True)
    
    
    
    
    
    
    
    

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

resolve()

Solution (Python):
s = input()
t = input()
ss = sorted(s)
tt = sorted(t,reverse=True)
for n, w in zip(ss,tt):
  if n < w:
    print("Yes")
    exit()
  elif n > w:
    print("No")
    exit()
if len(ss) >= len(tt):
  print("No")
else:
  print("Yes")