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=list(input())
t=list(input())
S=''.join(sorted(s))
T=''.join(sorted(t)[::-1])
L=sorted([S,T])

if S==T:
  print('No')
else:
  if L[0]==S:
    print('Yes')
  else:
    print('No')

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

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

Solution (Python):
s = input()
t = input()
Alphabet = list(['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']
)

flag = 0
S = sorted(s)
T = sorted(t,reverse = True)
for i in range(min(len(S),len(T))) :
    if S[i] == T[i] :
        flag += 1
    else :
        for j in range(len(Alphabet)) :
            if S[i] == Alphabet[j] :
                print("Yes")
                flag += -10000
                break
            elif T[i] == Alphabet[j] :
                print("No")
                flag += -10000
                break
            else :
                continue
        break
    
if flag == min(len(S),len(T)) :
    if len(S) >= len(T) :
        print("No")
    elif s != t :
        print("Yes")
    else :
        print("No")

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

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

test = [s_dash, t_dash]

if s_dash == t_dash:
    print("No")
else:
    if sorted(test)[0] != s_dash:
        print("No")
    else:
        print("Yes")

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
s=sorted;print(s(input())<s(input(),reverse=1)and"Yes"or"No")

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

Solution (Python):
s=sorted;print(['No','Yes'][s(input())<s(input())[::-1]])

Solution (Python):
s=sorted;print(['No','Yes'][s(input())<s(input(),reverse=1)])

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

Solution (Python):
s=list(input())
t=list(input())
s.sort()
t.sort()
t.reverse()
s=''.join(s)
t=''.join(t)
u=[]
u.append(s)
u.append(t)
u.sort()
print("Yes" if u[0]==s and s!=t else "No")

Solution (Python):


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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


if __name__ == '__main__':
    main()

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

sd = "".join(sorted(list(S)))
td = "".join(sorted(list(T), reverse=True))

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

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

Solution (Python):

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

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

ans=sorted([tt,ss])

if ss==tt:
    print('No')
else:
    print(['No','Yes'][ans[0]==ss])

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

ss = list(input())
tt = list(input())
ss.sort()
tt.sort(reverse=True)
S = ''
T = ''
for s in ss:
	S = S + s
for t in tt:
	T = T + t

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

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

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

Solution (Python):
s = list(input())
t = list(input())
s.sort()
flag = True
i = 0
ans = False
while flag:
    ans = False
    for x in t:
        if s[i] < x:
            flag = False
            ans = True
        elif s[i] == x:
            ans = True
    if ans and flag:
        t.remove(s[i])
        if i + 1 < len(s):
            i += 1
        elif t == []:
            flag = False
            ans = False
        else:
            flag = False
            ans = True
    elif not ans:
        flag = False
if ans:
    print('Yes')
else:
    print('No')

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

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

ans = sorted([tt,ss])

if ss == tt:
    print('No')
else:
    print(['No', 'Yes'][ans[0] == ss])

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

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

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

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

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

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

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

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

ss = ''
tt = ''
for i in range(len(s)):
    ss += s[i]
for i in range(len(t)):
    tt += t[i]

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

Solution (Python):


s=input()
lists=[]
for i in range(len(s)):
    lists.append(s[i])
    
t=input()
listt=[]
for j in range(len(t)):
    listt.append(t[j])
    
lists.sort()
listt.sort(reverse=True)

list1=[lists,listt]
list1.sort()
if lists==listt:
    print("No")
elif list1[0]==lists:
    print("Yes")
else:
    print("No")

Solution (Python):
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t,reverse=True)
counter = 0
for i in range(min(len(s),len(t))) :
    if s[i] != t[i] :
        L = []
        L.append(s[i])
        L.append(t[i])
        K = sorted(L)
        if L[0] == K[0] :
            print("Yes")
            break
        else :
            print("No")
            break
    else :
        counter += 1
        continue
if counter == min(len(s),len(t)) :
    if len(s) < len(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 = "".join(sorted(list(input())))
t = "".join(sorted(list(input()), reverse=True))
if s < t:
  print("Yes")
else:
  print("No")

Solution (Python):
a="".join(list(sorted(input())))
b="".join(list(sorted(input()))[::-1])
u=list(sorted([a,b]))
if u[0]==u[1]:
  print("No")
elif u[0]==a:
  print("Yes")
else:
  print("No")

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

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

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

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

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

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

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

s.sort()
t.sort()

t1 = t[::-1]

s2 = ''.join(s)
t2 = ''.join(t1)

print('Yes' if s2<t2 else 'No')

Solution (Python):
s=input()
t=input()
a,b=[],[]
for i in s:
    a.append(ord(i))
for i in t:
    b.append(ord(i))
a.sort()
b.sort()
b=b[::-1]

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

Solution (Python):


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

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

    if len(set(s)) == 1 and len(set(t)) == 1 and set(s) == set(t) and len(s) < len(t):
        print('Yes')
        exit()
 
    for i in range(min(len(s), len(t))):
        if ord(s[i]) < ord(t[i]):
            print('Yes')
            exit()
    print('No')
        
if __name__ == '__main__':
    main()

Solution (Python):
import sys
from itertools import zip_longest

s = input()
t = input()

tmp = list(s)
tmp.sort()
s_ = "".join(tmp)

tmp = list(t)
tmp.sort(reverse=True)
t_ = "".join(tmp)

st_ = [s_, t_]
st_.sort()

if s_ == t_:
    print("No")
elif st_[0] == s_:
    print("Yes")
else:
    print("No")

Solution (Python):



s = input()
t = input()








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

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

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

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

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

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

s = list(s)
s.sort()
s = "".join(s)

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

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

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

if ''.join(map(str, t))>''.join(map(str, s)):
    print('Yes')
else:
    print('No')

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

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

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

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

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

Solution (Python):
"""
https://abc082.contest.atcoder.jp/tasks/abc082_b
"""
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()
st = sorted(s)
tt = sorted(t)
tt.reverse()
if st<tt:
  print("Yes")
else:
  print("No")

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

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

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

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

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

s.sort()
t.sort()

t.reverse()

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

if s_sort<t_sort:
    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=raw_input()
t=raw_input()
sa=''.join(sorted(s))
tz=''.join(sorted(t,reverse=True))
if sa < tz:
  print 'Yes'
else:
  print 'No'

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

s_m = l.index(s[0])
s_M = l.index(s[0])
for i in s:
    if l.index(i) < s_m:
        s_m = l.index(i)
    if l.index(i) > s_M:
        s_M = l.index(i)

t_m = l.index(t[0])
t_M = l.index(t[0])
for j in t:
    if l.index(j) < t_m:
        t_m = l.index(j)
    if l.index(j) > t_M:
        t_M = l.index(j)

if s_m == s_M == t_m == t_M:
    if len(s) < len(t):
        print("Yes")
    else:
        print("No")
elif s_m < t_M:
    print("Yes")
else:
    print("No")

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

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

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

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

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

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

Solution (Python):


s_list = list(input())
t_list = list(input())


s_list.sort()

t_list.sort(reverse=True)


if "".join(s_list) < "".join(t_list):
    print("Yes")
else:
    print("No")

Solution (Python):


s_list = list(input())
t_list = list(input())


s_list.sort()

t_list.sort(reverse=True)

res_list = []
res_list.append("".join(s_list))
res_list.append("".join(t_list))
res_list.sort()


if "".join(s_list) == "".join(t_list):
    print("No")

elif res_list[0] == "".join(s_list):
    print("Yes")
else:
    print("No")

Solution (Python):


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

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

s.sort()
t.sort()

while len(s)>0 and len(t)>0:
    if min(s)<max(t):
        print("Yes")
        exit()
    elif min(s)==max(t):
        del s[0]
        del t[len(t)-1]
    else:
        print("No")
        exit()
if len(t)==0:
    
    print("No")
else:
    print("Yes")

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

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

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

s = [i for i in s]
s.sort()
t = [i for i in t]
t.sort(reverse=True)
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])
    
for i in range(len(t)):
    T.append(t[i])
    
S.sort()
T.sort()
T.reverse()

if S == T:
    print('No')
    
elif min(S, T) == S:
    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):
print(('No','Yes')[sorted(input()) < sorted(input())[::-1]])

Solution (Python):
d = dict()
d['a'] = 1
d['b'] = 2
d['c'] = 3
d['d'] = 4
d['e'] = 5
d['f'] = 6
d['g'] = 7
d['h'] = 8
d['i'] = 9
d['j'] = 10
d['k'] = 11
d['l'] = 12
d['m'] = 13
d['n'] = 14
d['o'] = 15
d['p'] = 16
d['q'] = 17
d['r'] = 18
d['s'] = 19
d['t'] = 20
d['u'] = 21
d['v'] = 22
d['w'] = 23
d['x'] = 24
d['y'] = 25
d['z'] = 26

e = dict()
e[1] = 'a'
e[2] = 'b'
e[3] = 'c'
e[4] = 'd'
e[5] = 'e'
e[6] = 'f'
e[7] = 'g'
e[8] = 'h'
e[9] = 'i'
e[10] = 'j'
e[11] = 'k'
e[12] = 'l'
e[13] = 'm'
e[14] = 'n'
e[15] = 'o'
e[16] = 'p'
e[17] = 'q'
e[18] = 'r'
e[19] = 's'
e[20] = 't'
e[21] = 'u'
e[22] = 'v'
e[23] = 'w'
e[24] = 'x'
e[25] = 'y'
e[26] = 'z'

s = input()
t = input()
lists = []
listt = []
for i in range(len(s)):
	lists.append(d[s[i]])
for i in range(len(t)):
	listt.append(d[t[i]])
lists.sort()
listt.sort()
listt.reverse()
check = True
for i in range(len(s)):
	if i < len(listt):
		if lists[i] < listt[i]:
			check = True
			break
		elif lists[i] > listt[i]:
			check = False
			break
		else:
			if i != len(t)-1:
				check = True
			else:
				check = False
if check:
	print('Yes')
else:
	print('No')

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

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

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

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

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

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

j = 0

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

Solution (Python):
s = input()
t = input()
alp = "abcdefghijklmnopqrstuvwxyz"
S = ""
T = ""
for i in range(len(alp)):
    for j in range(len(s)):
        if alp[i] == s[j]:
            S += s[j]
for i in range(len(alp)):
    for j in range(len(t)):
        if alp[i] == t[j]:
            T += t[j]
TT = T[::-1]
if S < TT:
    print("Yes")
else:
    print("No")

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

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

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

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

Solution (Python):

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

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

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

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

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

s_sorted = "".join(sorted(s))
t_sorted = "".join(reversed(sorted(t)))

if s_sorted < t_sorted:
    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 = 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().strip()
t=input().strip()
s=''.join(sorted(s))
t=''.join(sorted(t,reverse=True))
print(['No','Yes'][s<t])

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

Solution (Python):
first = sorted(input(''))
second = sorted(input(''), reverse=True)
result = False
check_equal = False
for (f, s) in zip(first, second):
  check_equal = (s == f)
  if not check_equal:
    result = (f < s)
    break
if (len(first) < len(second) and check_equal) or result:
  print('Yes')
else:
  print('No')

Solution (Python):
first = sorted(list(input('')))
second = sorted(list(input('')), reverse=True)
result = False
check_equal = False
for (f, s) in zip(first, second):
  check_equal = (s == f)
  if not check_equal:
    result = (f < s)
    break
if (len(first) < len(second) and check_equal) or result:
  print('Yes')
else:
  print('No')

Solution (Python):
first = sorted(list(input('')))
second = sorted(list(input('')), reverse=True)
length = len(first) < len(second)

result = False
check_equal = False
for (f, s) in zip(first, second):
  check_equal = (s == f)
  if not check_equal:
    result = (f < s)
    break

if (length and check_equal) or result:
  print('Yes')
else:
  print('No')

Solution (Python):
first = sorted(list(input('')))
second = sorted(list(input('')), reverse=True)
length = len(first) < len(second)

result = False
check_equal = False
for (f, s) in zip(first, second):
  check_equal = (s == f)
  if f < s:
    result = True
    break
  elif f > s:
    result = False
    break

if (length and check_equal) or result:
  print('Yes')
else:
  print('No')

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

Solution (Python):
x = [sorted(list(input())) for _ in range(2)]
x[1] = list(reversed(x[1]))
y = sorted(x)
print(["No","Yes"][x==y and x[0] != x[1]])

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

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

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

Solution (Python):
s = [list(input()) for _ in range(2)]
s[0].sort()
s[1].sort(reverse=True)
if ''.join(s[0]) < ''.join(s[1]):
    print("Yes")
else:
    print("No")

Solution (Python):
s=sorted(input())
t=sorted(input(),reverse=True)
a=sorted([s,t])
if s==t:
    print("No")
    exit()
if a[0]==s:
    print("Yes")
else:
    print("No")

Solution (Python):
s_str = input()
t_str = input()
s = [s_str[i] for i in range(len(s_str))]
t = [t_str[i] for i in range(len(t_str))]
s.sort()
t.sort(reverse=True)
for i in range(min(len(s), len(t))):
    if s[i] > t[i]:
        print('No')
        exit()
    elif s[i] < t[i]:
        print('Yes')
        exit()
if len(s) < len(t):
    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=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()
t.reverse()

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

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

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

j = 0
for i in s:
    if i < t[j]:
        print('Yes')
        break

    elif i > t[j]:
        print('No')
        break

    else:
        j += 1
        if j == len(t):
            print('No')
            break
        elif j == len(s):
            print('Yes')
            break

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

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

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

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

L = sorted([s,t])

if s==t:
    print("No")
elif L[0]==s:
    print("Yes")
else:
    print("No")

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

a = ''.join(sorted(a))
b = ''.join(sorted(b,reverse=True))
if a < b:
    print('Yes')
else:
    print('No')

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

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

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

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

    return

if __name__ == '__main__':
    main()

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

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

    return

if __name__ == '__main__':
    main()

Solution (Python):
s = input()
t = input()
u = "".join(sorted([x for x in s]))
v = "".join(reversed(sorted([x for x in t])))

if u==v:
    print("No")
    exit(0)

W = sorted([u,v])
print("Yes" if W[0]==u else "No")

Solution (Python):
s = list(input())
t = list(input())
li =[]

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

if li[0] != s:
    print("No")
elif s == t:
    print("No")
else:
    print("Yes")

Solution (Python):
s, t = input(), input()
s_lst, t_lst = [], []

for i in s:
    s_lst.append(i)

for j in t:
    t_lst.append(j)

s_lst.sort()
t_lst.sort(reverse=True)

s, t = "".join(s_lst), "".join(t_lst)
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)
A = "No"
for sc,tc in zip(S,T):
    if sc == tc:
        continue
    elif sc < tc:
        A = "Yes"
        break
    else:
        break
if S == T[:len(S)] and len(S) < len(T):
    A = "Yes"
print(A)

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

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

Solution (Python):
str_list1 = list(input())
str_list2 = list(input())
str_list2_inv = [i for i in sorted(str_list2)[::-1]]
str1 = ''.join(sorted(str_list1))
str2 = ''.join(str_list2_inv)
if str1 == str2:
    print('No')
elif sorted([str1,str2])[0] == str1:
    print('Yes')
else:
    print('No')

Solution (Python):
def alf(a):
   A = "abcdefghijklmnopqrstuvwxyz"
   for l in range(26):
      if a == A[l]:
         return l
   return -1

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

   S = []
   for s in s:
      S.append([alf(s), s])
   T = []
   for t in t:
      T.append([alf(t), t])
   
   S.sort()
   T.sort()
   T = T[::-1]
   for i in range(len(S)):
      if i == len(T):
         return "No"
      elif S[i] < T[i]:
         return "Yes"
      elif S[i] > T[i]:
         return "No"
   if len(S)==len(T):
      return "No"
   else:
      return "Yes"

print(main())

Solution (Python):
from collections import Counter
def rearange(x):
    counter=Counter(x)
    x_=''
    for i in range(26):
        num=ord('a')+i
        x_+=chr(num)*counter[chr(num)]
    return x_

s=input()
t=input()

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

Solution (Python):
from itertools import zip_longest

def twoAnagrams(s, t):
    s_str = ''.join(sorted(s))
    t_str = ''.join(sorted(t, reverse=True))

    if t_str.startswith(s_str):
        if len(s_str) < len(t_str):
            return True
        
        else:
            return False

    for s_chr,t_chr in zip_longest(s_str, t_str):
        if s_chr is None:
            return True
        elif t_chr is None or t_chr < s_chr:
            return False
        elif s_chr < t_chr:
            return True


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

print('Yes' if twoAnagrams(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 = input()
t = input()

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

Solution (Python):
s = input().strip()
s_sorted = sorted(s)
t = input().strip()
t_sorted = sorted(t, reverse=True)

for i in range(min(len(s), len(t))):
    if s_sorted[i] < t_sorted[i]:
        print('Yes')
        exit()
    elif  s_sorted[i] > t_sorted[i]:
        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("Yes")
else:
    print("No")

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

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

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

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

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

Solution (Python):






if __name__ == '__main__':
    s = sorted(list(input()))
    t = sorted(list(input()), reverse=True)

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

Solution (Python):
i=input
print(['No','Yes'][sorted(i())<sorted(i())[::-1]])

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

Solution (Python):
import math
import sys

def getinputdata():

    
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

s = arr_data[0][0]
t = arr_data[1][0]





arr1=[]
arr2=[]

for v in s:
    
    arr1.append(v)
    
arr1_sort=sorted(arr1)

for v in t:
    
    arr2.append(v)
    
arr2_sort=sorted(arr2,reverse=True)


str1="".join(arr1_sort)
str2="".join(arr2_sort)



if(str1<str2):
    
    print("Yes")
    
else:
    
    print("No")

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

ss = list(s)
tt = list(t)

ss.sort()
tt.sort(reverse=True)

s1 = ''.join(ss)
t1 = ''.join(tt)

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

Solution (Python):
s = input()
t = input()
slist,tlist = [],[]
for i in s:
	slist.append(i)
for i in t:
	tlist.append(i)
slist.sort()
tlist.sort()
tlist = tlist[::-1]
for j in range(min(len(slist),len(tlist))):
	if ord(slist[j]) < ord(tlist[j]):
		print("Yes")
		break
	elif ord(slist[j]) > ord(tlist[j]):
		print("No")
		break
	else:
		if j == min(len(slist),len(tlist))-1:
			if len(slist) < len(tlist): print("Yes")
			else: print("No")

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

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

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