#include<stdio.h>
#include<math.h>
int main()
{
int a,b,aa,bb,t=0,i,gongyue,gongbei;
scanf("%d%d",&a,&b);
if(a>=b)
{ t=a%b;aa=a; bb=b;
if(!t)gongbei=a;
while(t)
{aa++;t=(aa%a)||(aa%b);}gongbei=aa;
t=a%b;aa=a;bb=b;
if(!t)gongyue=b;
while(t)
{ bb--;t=(a%bb)||(b%bb);}gongyue=bb;
}
else
{ i=a;a=b;b=i;
t=a%b;aa=a; bb=b;
if(!t)gongbei=a;
while(t)
{ aa++;t=(aa%a)||(aa%b); }gongbei=aa;
t=a%b;aa=a; bb=b;
if(!t)gongyue=b;
while(t)
{ bb--; t=(a%bb)||(b%bb); } gongyue=bb;
}
printf("%d %d",gongbei,gongyue);
return 0;
}