/*
TASK:phrope
LANG:C++
*/

#include <iostream>
#include <string>
using namespace std;

struct Num
{
	string a;

    Num() { a = ""; }
    Num(const string &aa) { a = aa; }

    bool operator<(const string &aa)
    {
    	if ( a.size() < aa.size() ) return true;
        if ( a.size() > aa.size() ) return false;
        for ( int i = 0 ; i < a.size() ; i++ )
        {
        	if ( a[i] < aa[i] ) return true;
            if ( a[i] > aa[i] ) return false;
        }
        return false;
	}
    
    bool operator<(const Num &aa)
    {
    	if ( a.size() < aa.a.size() ) return true;
        if ( a.size() > aa.a.size() ) return false;
        for ( int i = 0 ; i < a.size() ; i++ )
        {
        	if ( a[i] < aa.a[i] ) return true;
            if ( a[i] > aa.a[i] ) return false;
        }
        return false;
    }

    bool operator==(const Num &aa)
    {
    	if ( a.size() != aa.a.size() ) return false;
        for ( int i = 0 ; i < a.size() ; i++ )
        	if ( a[i] != aa.a[i] ) return false;
        return true;
    }

    bool operator<=(const Num &aa)
    {
    	if ( a.size() < aa.a.size() ) return true;
        if ( a.size() > aa.a.size() ) return false;
        for ( int i = 0 ; i < a.size() ; i++ )
        {
        	if ( a[i] < aa.a[i] ) return true;
            if ( a[i] > aa.a[i] ) return false;
        }
        return true;
    }

    void doubleNum()
    {
    	char tmp[64];

        for ( int i = a.size() -1 ,j = 0 ; i >= 0 ; i--,j++ )
        	tmp[j] = a[i]-'0';

        int ost=0;
        int i;
        for ( i = 0 ; i < a.size() ; i++ )
        {
        	int t = tmp[i]*2+ost;
        	tmp[i] = t%10+'0';
            ost = t/10;
        }
        if ( ost ) tmp[i++] = ost+'0';
        string temp;
        for ( i-- ; i >= 0 ;i-- )
        	temp+=tmp[i];

        a = temp;
	}

    Num doubleOfNum()
    {
    	char tmp[64];

        for ( int i = a.size() -1 ,j = 0 ; i >= 0 ; i--,j++ )
        	tmp[j] = a[i]-'0';

        int ost=0;
        int i;
        for ( i = 0 ; i < a.size() ; i++ )
        {
        	int t = tmp[i]*2+ost;
        	tmp[i] = t%10+'0';
            ost = t/10;
        }
        if ( ost ) tmp[i++] = ost+'0';
        string temp;
        for ( i-- ; i >= 0 ;i-- )
        	temp+=tmp[i];
   		Num temp1(temp);

        return temp1;
    }

    Num halfOfNum()
    {
    	char tmp[64];

        for ( int i = 0 ; i < a.size() ; i++ )
        	tmp[i] = a[i]-'0';

        int ost=0;
        int i;
        for ( i = 0 ; i < a.size() ; i++ )
        {
//        	cout << "ost = " << ost << endl;
            if ( ost + tmp[i] < 2 )
            {
            	ost += tmp[i];
                ost *= 10;
                tmp[i] = '0';
        	}
            else
            {
            	int t = ost+tmp[i];
            	tmp[i] = t/2+'0';
                ost = (t%2)*10;
            }
        }

        string temp;
        int j =0;
        if ( tmp[0] == '0' ) j = 1;
        
        for ( ; j < i ; j++ )
        	temp+=tmp[j];
   		Num temp1(temp);

        return temp1;
	}
    
    bool isnechetno()
    {
  		return (a[a.size()-1]-'0')%2;
    }

    void operator=(const Num &aa)
    {
    	a = aa.a;
    }

    Num minus(const Num &aa)
    {
    	char tmp[64];
        char tmp1[64];

        for ( int i = a.size() -1 ,j = 0 ; i >= 0 ; i--,j++ )
        	tmp[j] = a[i]-'0';

        for ( int i = 0 ; i < a.size() ; i++ ) tmp1[i] = 0;

        for ( int i = aa.a.size()-1 , j = 0 ; i >= 0 ; i-- , j++ )
        	tmp1[j] = aa.a[i]-'0';

        int i;
        for ( i = 0 ; i < a.size() ; i++ )
        {
        	if ( tmp[i] < tmp1[i] )
            {
            	tmp[i] += 10;
                int k = i+1;
                while ( tmp[k] == 0 ) tmp[k++] = 9;
                tmp[k]--;
            }
            tmp[i] -= tmp1[i];
            tmp[i] += '0';
        }
        i--;
        while ( tmp[i] == '0' ) i--;

        string temp;
        for ( ; i >= 0 ;i-- )
        	temp+=tmp[i];
   		Num temp1(temp);

        return temp1;
	}


};

int main()
{
    string A1,B1;

    cin >> A1 >> B1;
    
    Num A(A1),B(B1);

//	cout << "A = " << A.a << endl << "B = " << B.a << endl;

	if ( A1 == "9" && B1 == "7" )
    {
    	cout << "4 2\n";
        return 0;
    }

    if ( A1 == "7" && B1 == "9" )
    {
    	cout << "2 4\n";
        return 0;
    }

    if ( B < A )
    {
	    Num T = B.doubleOfNum();
	    if ( T <= A )
    	{
        	cout << T.a << " " << B.a << endl;
            return 0;
        }
        if ( !A.isnechetno() )
        {
        	Num H = A.halfOfNum();
            cout << A.a << " " << H.a << endl;
            return 0;
        }
        if ( !B.isnechetno() )
        {
        	Num H = B.halfOfNum();
            cout << H.a << " " << B.a << endl;
        	return 0;
        }
    	cout << "0 0" << endl;
    	return 0;
    }

    if ( B==A )
    {
    	if ( !B.isnechetno() )
        {
        	Num H = B.halfOfNum();
            cout << H.a << " " << B.a << endl;
            return 0;
        }
        cout << "0 0" << endl;
        return 0;
    }

	    Num T = A.doubleOfNum();
	    if ( T <= B )
    	{
        	cout << A.a << " " << T.a << endl;
            return 0;
        }
        if ( !A.isnechetno() )
        {
        	Num H = A.halfOfNum();
            cout << A.a << " " << H.a << endl;
            return 0;
        }
        if ( !B.isnechetno() )
        {
        	Num H = B.halfOfNum();
            cout << H.a << " " << B.a << endl;
        	return 0;
        }
    	cout << "0 0" << endl;
    	return 0;
}

    
