#pragma warning disable

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

static class MainClass
{
    public static void Main(string[] args)
    {
        var scanner = new Scanner();
        var s = scanner.NextLine().Trim();
        var t = scanner.NextLine().Trim();
        var sorteds = new string(s.OrderBy(x => x).ToArray());
        var sortedt = new string(t.OrderByDescending(x => x).ToArray());
        if (sorteds.CompareTo(sortedt) < 0)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
        // for scanner bug
        scanner.Next();
    }


    // s番目の頂点から各々の頂点への最短距離を求めるBellman-Ford

    public static void InitializeBellmanFord(int v, int e, IEnumerable<Edge> edges)
    {
        V = v;
        Edges = edges.ToArray();
        ShortestDistances = new int[V];
        E = e;
    }

    public class Edge
    {
        public int From;
        public int To;
        public int Cost;
    }

    public static Edge[] Edges;

    public static int[] ShortestDistances;

    public static int[] PreviousVisited;

    public static int V;

    public static int E;

    public static void SearchShortestPath(int s)
    {
        for (int i = 0; i < V; i++)
        {
            ShortestDistances[i] = INF;
            PreviousVisited[i] = -1;
        }
        ShortestDistances[s] = 0;
        while (true)
        {
            var update = false;
            for (int i = 0; i < E; i++)
            {
                var e = Edges[i];
                if (ShortestDistances[e.From] != INF && ShortestDistances[e.To] > ShortestDistances[e.From] + e.Cost)
                {
                    ShortestDistances[e.To] = ShortestDistances[e.From] + e.Cost;
                    update = true;
                    PreviousVisited[e.To] = e.From;
                }
            }
            if (!update)
                break;
        }
    }

    public static List<int> GetRouteToG(int g)
    {
        var ls = new List<int>();
        for (; g != -1; g = PreviousVisited[g])
        {
            ls.Add(g);
        }
        ls.Reverse();
        return ls;
    }

    // 負閉路をもつか？
    public static bool HasNegativeLoopAllgraph()
    {
        var d = new int[V];
        for (int i = 0; i < V; i++)
        {
            for (int j = 0; j < E; j++)
            {
                var e = Edges[j];
                if (d[e.To] > d[e.From] + e.Cost)
                {
                    d[e.To] = d[e.From] + e.Cost;
                    if (i == V - 1)
                    {
                        return true;
                    }
                }
            }
        }
        return false;
    }
    // 負閉路をもつか？（start固定）
    public static bool HasNegativeLoopFromS(int s)
    {
        var d = new int[V];
        for (int i = 0; i < V; i++)
        {
            d[i] = INF;
        }
        d[s] = 0;
        for (int i = 0; i < V; i++)
        {
            for (int j = 0; j < E; j++)
            {
                var e = Edges[j];
                if (d[e.From] != INF && d[e.To] > d[e.From] + e.Cost)
                {
                    d[e.To] = d[e.From] + e.Cost;
                    if (i == V - 1)
                        return true;
                }
            }
        }
        return false;
    }
    // 負閉路をもつか？(start,destination固定)
    public static bool HasNegativeLoopFromSToG(int s, int g)
    {
        var d = new int[V];
        for (int i = 0; i < V; i++)
        {
            d[i] = INF;
        }
        d[s] = 0;
        for (int i = 0; i < 2 * V; i++)
        {
            for (int j = 0; j < E; j++)
            {
                var e = Edges[j];
                if (d[e.From] != INF && d[e.To] > d[e.From] + e.Cost)
                {
                    d[e.To] = d[e.From] + e.Cost;
                    if (i >= V - 1 && e.To == g)
                        return true;
                }
            }
        }
        return false;
    }



    public static int LowerBound<T>(this List<T> arr, int start, int end, T value, IComparer<T> comparer)
    {
        int low = start;
        int high = end;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (comparer.Compare(arr[mid], value) < 0)
                low = mid + 1;
            else
                high = mid;
        }
        return low;
    }

    public static int LowerBound<T>(this List<T> arr, T value) where T : IComparable
    {
        return LowerBound(arr, 0, arr.Count(), value, Comparer<T>.Default);
    }

    public static int UpperBound<T>(this List<T> arr, int start, int end, T value, IComparer<T> comparer)
    {
        int low = start;
        int high = end;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (comparer.Compare(arr[mid], value) <= 0)
                low = mid + 1;
            else
                high = mid;
        }
        return low;
    }

    public static int UpperBound<T>(this List<T> arr, T value)
    {
        return UpperBound(arr, 0, arr.Count(), value, Comparer<T>.Default);
    }


    #region
    public static int ParentCount;

    public static int[] Parents;
    public static int[] IfParentsChildrenCount;

    public static int[] Ranks;

    public static void InitializeUnionFind(int N)
    {
        Parents = new int[N];
        Ranks = new int[N];
        IfParentsChildrenCount = new int[N];
        for (int i = 0; i < N; i++)
        {
            Parents[i] = i;
            Ranks[i] = 0;
            IfParentsChildrenCount[i] = 1;
        }
        ParentCount = N + 1;
    }

    public static int Root(int a)
    {
        if (Parents[a] == a)
        {
            return a;
        }
        else
        {
            Parents[a] = Root(Parents[a]);
            return Parents[a];
        }
    }

    public static bool Same(int a, int b)
    {
        return Root(a) == Root(b);
    }

    public static void Unite(int a, int b)
    {
        var parentA = Root(a);
        var parentB = Root(b);
        if (parentA == parentB)
            return;
        if (Ranks[parentA] < Ranks[parentB])
        {
            Parents[parentA] = parentB;
            IfParentsChildrenCount[parentB] += IfParentsChildrenCount[parentA];
            ParentCount -= IfParentsChildrenCount[parentA];

            IfParentsChildrenCount[parentA] = 0;
        }
        else
        {
            Parents[parentB] = parentA;
            if (Ranks[parentA] == Ranks[parentB])
            {
                Ranks[parentA]++;
            }
            IfParentsChildrenCount[parentA] += IfParentsChildrenCount[parentB];
            ParentCount -= IfParentsChildrenCount[parentB];
            IfParentsChildrenCount[parentB] = 0;
        }
    }
    #endregion
    #region ライブラリ

    public static long ToInt64(this string str) => long.Parse(str);
    public static bool IsInt32(this string str)
    {
        var ou = 0;
        return int.TryParse(str, out ou);
    }
    public static int ToInt32(this string str) => str == "" ? 0 : int.Parse(str);
    public static double ToDouble(this string str) => double.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<long> SplittedStringToInt64List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 4;
    public const long LONGINF = long.MaxValue / 2;
    public const int Mod1e9 = 1000000007;

    public static void PrintArray(int[,] array)
    {
        for (int i = 0; i < array.GetLength(0); i++)
        {
            var sb = new StringBuilder();
            for (int j = 0; j < array.GetLength(1); j++)
            {
                sb.Append(array[i, j]);
            }
            Console.WriteLine(sb.ToString());
        }
    }
    public static int Manhattan(int x1, int x2, int y1, int y2)
    {
        return Math.Abs(x1 - x2) + Math.Abs(y1 - y2);
    }

    public static int Manhattan(KeyValuePair<int, int> keyValuePair1, KeyValuePair<int, int> keyValuePair2)
    {
        return Manhattan(keyValuePair1.Key, keyValuePair2.Key, keyValuePair1.Value, keyValuePair2.Value);
    }

    public static Dictionary<T, int> ToCountedDictionary<T>(this IEnumerable<T> items)
    {
        var dic = new Dictionary<T, int>();
        foreach (var item in items)
        {
            if (dic.ContainsKey(item))
                dic[item]++;
            else
                dic.Add(item, 1);
        }
        return dic;
    }
    public static Dictionary<TKey, TValue> KeyValuePairListToDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> pairs)
    {
        var dic = new Dictionary<TKey, TValue>();
        foreach (var item in pairs)
        {
            dic.Add(item.Key, item.Value);
        }
        return dic;
    }
    public class Scanner
    {
        private TextReader reader;
        public Scanner()
        {
            reader = Console.In;
        }
        public Scanner(TextReader reader)
        {
            this.reader = reader;
        }
        private string NextWord()
        {
            var sb = new StringBuilder();
            while (true)
            {
                var c = reader.Read();
                if ((c == 13 || c == 10 || c == 32) && sb.Length > 0 || c == -1)
                {
                    break;
                }
                sb.Append((char)c);
            }
            return sb.ToString().Trim();
        }
        public int NextInt() => NextWord().ToInt32();
        public string Next() => NextWord();
        public double NextDouble() => NextWord().ToDouble();
        public long NextLong() => NextWord().ToInt64();
        public BigInteger NextBigInteger() => NextWord().ToBigInteger();
        public string NextLine()
        {
            var str = reader.ReadLine();
            if (string.IsNullOrWhiteSpace(str))
            {
                return reader.ReadLine();
            }
            else
            {
                return str;
            }
        }
        private List<string> NextLineToList() => NextLine().Split(new char[] { ' ' },
                                                                  StringSplitOptions.RemoveEmptyEntries)
                                                           .ToList();
        public List<int> NextLineToIntList() => NextLineToList().Select(x => int.Parse(x))
                                                                .ToList();
    }
    public static long Sums(IEnumerable<int> list)
    {
        var sum = 0l;
        foreach (var item in list)
        {
            sum += Math.Abs(item);
        }
        return sum;
        #endregion
    }

    public static int[] dx = { -1, 1, 0, 0 };
    public static int[] dy = { 0, 0, 1, -1 };

    public static int[] dxx = { 0, 1, 1, 1, 0, -1, -1, -1 };
    public static int[] dyy = { 1, 1, 0, -1, -1, -1, 0, 1 };

}



Measured memory_bytes: 13536