/*
TASK: phrope
LANG: C
*/

#include <stdio.h>
#include <string.h>
#include <math.h>
#define MAX 64
FILE *in; FILE *out;
char a[MAX]; int lena;
char b[MAX]; int lenb;
char tmp[MAX]; int lent;

void init(void)
{
int i, c;

for (i=0; i<MAX; i++) {a[i] = 0; b[i] = 0; tmp[i] = 0;}

return;
}


void input(void)
{
//in = fopen("phrope.in", "rt"); out = fopen("phrope.out", "wt");
in = stdin; out = stdout;

fscanf(in, "%s", a);
fscanf(in, "%s", b);
lena = strlen(a); lenb = strlen(b);

fclose(in);

return;
}

void output(void)
{
int i;

fprintf(out, "0 0\n");

/*
fprintf(out, "num one: %s with len of %d\n", a, lena);
fprintf(out, "num two: %s with len of %d\n", b, lenb);
fprintf(out, "Input successful!\n");
*/

//for (i=0; i<128; i++) fprintf(out, "Character Nr.%d is %c\n", i, i);


fclose(out);

return;
}

void mul(char tt[MAX], int d)
{
int i, len;
int save = 0;
char t[MAX];

if (d!=2) return;

len = strlen(tt); save = 0;
for (i=0; i<len; i++) t[len-i-1] = tt[i]-48;

for (i=0; i<MAX; i++) tmp[i] = 0; lent = 0;
for (i=0; i<len; i++) tmp[i] = t[i]*d;

for (i=0; i<len; i++)
    {
    tmp[i] += save; save = 0;
    if (tmp[i]>=10)
       {
       save = floor(tmp[i]/10);
       tmp[i] %= 10;
       }
    }
if (save) {tmp[len] = save; save = 0; len++;}

for (i=0; i<len; i++) t[i] = tmp[i];
for (i=0; i<len; i++) tmp[len-i-1] = t[i]+48;
lent = len;

return;
}

void div(char tt[MAX], int d)
{
int i, c, len, save = 0;
char t[MAX];

if (d!=2) return;

len = strlen(tt); c = 0; save = 0;
for (i=0; i<MAX; i++) t[i] = tt[i]-48;

for (i=0; i<MAX; i++) tmp[i] = 0; lent = 0;
for (i=0; i<len; i++)
    {
    save*=10; save+=t[i];

    if (save>=2)
	{
	if (save%2==0) {tmp[c] = save/2; c++; save = 0;}
	else {tmp[c] = (save-1)/2; c++; save = 1;}
	}
    else {tmp[c] = 0; c++;}
    }

save = 0;

for (i=0; i<c; i++)
    {
    tmp[i] += save; save = 0;
    if (tmp[i]>=10)
       {
       save = floor(tmp[i]/10);
       tmp[i] %= 10;
       }
    }
len = c;
if (save) {tmp[len] = save; save = 0; len++;}

//for (i=0; i<len; i++) fprintf(out, "%c", tmp[i]+48); fprintf(out, "\n");

for (i=0; i<len; i++) t[i] = tmp[len-i-1];
for (i=len-1; i>=0; i--) {if (t[i]==0) {len--;} else break;}
//for (i=0; i<len; i++) fprintf(out, "%c", t[i]+48); fprintf(out, "\nlen:%d\n", len);
for (i=0; i<len; i++) tmp[i] = t[len-i-1]+48;
for (i=len; i<MAX; i++) tmp[i] = 0;

//for (i=0; i<len; i++) tmp[i]+=48;
lent = len;

return;
}

int cmp(char t1[MAX], char t2[MAX])
{
int i;

int len1, len2;

len1 = strlen(t1);
len2 = strlen(t2);

if (len1>len2) return 1;
if (len2>len1) return -1;

for (i=0; i<len1; i++)
    {
    if (t1[i]>t2[i]) return 1;
    if (t2[i]>t1[i]) return -1;
    }

return 0;
}


void sub(char tt1[MAX], char tt2[MAX])
{
int i, c, save;
int len1, len2;
char t1[MAX], t2[MAX];

len1 = strlen(tt1);
len2 = strlen(tt2);

for (i=0; i<MAX; i++) tmp[i] = 0; lent = 0;
for (i=0; i<len1; i++) t1[i] = tt1[len1-i-1]-48;
for (i=0; i<len2; i++) t2[i] = tt2[len2-i-1]-48;

save = 0;

for (i=0; i<len1; i++)
    {
    tmp[i] -= save; save = 0;
    tmp[i] += (t1[i]-t2[i]);
    if (tmp[i]<0) {tmp[i] += 10; save = 1;}
    }
lent = len1;

//for (i=0; i<lent; i++) fprintf(out, "%c", tmp[i]+48); fprintf(out, "\n");

for (i=lent-1; i>=0; i--) {if (tmp[i] == 0) lent--; else break;}
for (i=0; i<lent; i++) t1[i] = tmp[i]+48;
for (i=0; i<lent; i++) tmp[i] = t1[lent-1-i];

return;
}


int dowork(void)
{
int i, c;

// If one of them divided by 2 is smaller than the other one //

// For A:

i = a[lena-1] - 48;
if (i%2 == 0)
{
div(a, 2);
c = cmp(b, tmp);
if (c!=-1)
   {
   fprintf(out, "%s %s\n", a, tmp);
   return 1;
   }
}

// For B:

i = b[lenb-1] - 48;
if (i%2 == 0)
{
div(b, 2);
c = cmp(a, tmp);
if (c!=-1)
   {
   fprintf(out, "%s %s\n", tmp, b);
   return 1;
   }
}
// ============================================================ //

// If one of them multiplied by 2 is smaller than the other one //

// For A:
mul(a, 2);
c = cmp(b, tmp);
if (c!=-1)
   {
   fprintf(out, "%s %s\n", a, tmp);
   return 1;
   }

// For B:
mul(b, 2);
c = cmp(a, tmp);
if (c!=-1)
   {
   fprintf(out, "%s %s\n", tmp, b);
   return 1;
   }
// ============================================================ //

// If the numbers are equal //

if (cmp(a, b) == 0) return 0;
// ======================== //

// If both numbers are odd and have small difference //

c = cmp(a, b);
if (c == 1)
   {
   sub(a, b);
//   fprintf(out, "%s - %s = %s\n", a, b, tmp);
//   for (i=0; i<lent; i++) fprintf(out, "%c", tmp[i]); fprintf(out, "\n");
   mul(tmp, 2);
   fprintf(out, "%s ", tmp);
   div(tmp, 2);
   fprintf(out, "%s\n", tmp);
   return 1;
   }

if (c == -1)
   {
   sub(b, a);
//   fprintf(out, "%s - %s = %s\n", b, a, tmp);
   fprintf(out, "%s ", tmp);
   mul(tmp, 2);
   fprintf(out, "%s\n", tmp);
   return 1;
   }
// ================================================= //

return 0;
}


int main(void)
{
int ans;

init();
input();
ans = dowork();
if (!ans) output();

return 0;
}
