/*
TASK:phrope
LANG:C++
*/
#include <stdio.h>
#include <string.h>
char a[64],b[64];
int isOdd(char *s)
{return s[strlen(s)-1] & 1;
}
int cmp(char *s1,char *s2)
{int l1=strlen(s1),l2=strlen(s2);
 if (l1>l2) return 1;
 if (l1<l2) return -1;
 return strcmp(s1,s2);
}
void swap(char *a, char *b)
{char c[64];
 strcpy(c,a);
 strcpy(a,b);
 strcpy(b,c);
}
char *muldig(char *s,char d,char *res)
{int l=strlen(s)-1,c=0,i,r;
 res[l+2]=0;
 for (i=l;i>=0;i--)
 {r=(s[i]-'0')*d+c;
  c=r/10;
  r=r%10;
  res[i+1]=r+'0';
 }
 if (c) *res=c+'0';
 else res++;
 return res;
}
char *sub(char *a, char *b, char *res)
{int bo=0,r,i,j,la=strlen(a)-1,lb=strlen(b)-1;
 for (i=la,j=lb;i>=0;i--,j--)
 {if (j>=0) r=a[i]-b[j]-bo;
  else r=a[i]-'0'-bo;
  if (r<0) {r+=10;bo=1;}
  else bo=0;
  res[i]=r+'0';
 }
 while (*res=='0') res++;
 if (!*res) res--;
 return res;
}
char *half(char *s, char *res)
{char *r=muldig(s,5,res);
 r[strlen(r)-1]=0;
 return r;
}
int firstMove(char *p, char *q)
{char s[64], *r;
 int f=cmp(a,b);
 if (f>0) swap(a,b);
 //a<=b/2?
 r=half(b,s);
 if (cmp(a,r)<=0)
 {strcpy(p,a);
  r=muldig(a,2,s);
  strcpy(q,r);
  if (f>0) swap(p,q);
  return 1;
 }
 //even a?
 if (!isOdd(a))
 {r=half(a,s);
  strcpy(p,a);
  strcpy(q,r);
  if (f>0) swap(p,q);
  return 1;
 }
 //even b?
 if (!isOdd(b))
 {r=half(b,s);
  strcpy(q,b);
  strcpy(p,r);
  if (f>0) swap(p,q);
  return 1;
 }
 //both odd
 if (!f) return 0;
 r=sub(b,a,s);
 strcpy(p,r);
 r=muldig(p,2,s);
 strcpy(q,r);
 if (f>0) swap(p,q);
 return 1;
}
int main (void)
{char p[64],q[64];
 scanf("%s %s",a,b);
 if (!firstMove(p,q)) printf("0 0\n");
 else printf("%s %s\n",p,q);
 return 0;
}