using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Numerics;

namespace PETLJA
{
    class Program
    {
        static void Main(string[] args)
        {
            Int64 x = Int64.Parse(Console.ReadLine());
            Int64 y = Int64.Parse(Console.ReadLine());
            Int64 a = 0;
            Int64 b = 1,c = 10, d = 1, q = 0, p = 0;
            while (d <= x || d <= y)
            {
                if (d > x)
                {
                    q = -1;
                }
                else
                {
                    q = x % c / d;
                }
                if (d > y)
                {
                    p = -1;
                }
                else
                {
                    p = y % c / d;
                }
                if (q == p)
                {
                    a += q * b;
                    b *= 10;
                    a += p * b;
                    b *= 10;
                }
                if (p > q)
                {
                    a += p * b;
                    b *= 10;
                }
                if (q > p)
                {
                    a += q * b;
                    b *= 10;
                }
                c *= 10;
                d *= 10;
            }
            Console.WriteLine(a);
        }
    }
}