/*
TASK:phrope
LANG:C++
*/
#include <iostream>
#include <cstring>
using namespace std;
string dev2(const char a[])
{
  int i;
  string res;
  bool fs=false;
  int ost=0;
  for(int i=0; i<strlen(a); i++)
  {
    if(a[i]=='1'&&i==0)
    {
       ost=1;
       i++;
    }
    res+=(10*ost+(a[i]-'0'))/2+'0';
    ost=(10*ost+(a[i]-'0'))%2;
  }
  return res;
}
string mult2(const char a[])
{
  string res;
  int r[51];
  int i,tmp=0;
  bool f=false;
  for(i=0; i<strlen(a); i++)
    r[i]=2*(a[i]-'0');
  for(i=0; i<strlen(a); i++)
  {
    //if(i==0&&r[i]>10)
      res+=tmp+r[i]/10+'0';
      tmp=r[i]%10;
  }
  return res;
}
int main()
{
  // a[51],b[51];
  string a,b  ;
  cin>>a>>b;
  if((a>=b)&&(dev2(a.c_str())<b)&&!((a.c_str()[strlen(a.c_str())-1]-'0')%2))
    cout<<a<<" "<<dev2(a.c_str());
  else if((b>=a)&&(dev2(b.c_str())<a)&&!((b.c_str()[strlen(b.c_str())-1]-'0')%2))
    cout<<dev2(b.c_str())<<" "<<b;
  else if((a<=b)&&(mult2(a.c_str())<=b)&&!((a.c_str()[strlen(a.c_str())-1]-'0')%2))
    cout<<a<<" "<<mult2(a.c_str());
  else if((b<=a)&&(mult2(b.c_str())<=a)&&!((b.c_str()[strlen(b.c_str())-1]-'0')%2))
    cout<<mult2(b.c_str())<<" "<<b;
  else
    cout<<"0 0";
  cout<<endl;
  return 0;
}
