#include<stdio.h>
#include<stdlib.h>
int main()
{
    int a,b,s,d, l, k;
    while(scanf("%d%d",&a,&b)!=EOF){
    s=a;d=b;l=a;k=b;
    if(a>b){ while(b>0){if(a%b==0&&d%b==0) break; else b=b-1;} printf("%d ",b);}
    else { while(a>0){if(b%a==0&&s%a==0) break; else a=a-1;} printf("%d ",a);
}
    s=l;d=k;a=l;b=k;
    if(a>b){ while(b>0){if(a%b==0&&a%s==0) break; else a=a+1;} printf("%d\n",a);}
    else { while(a>0){if(b%a==0&&b%d==0) break; else b=b+1;} printf("%d\n",b);}
    }
    return 0;
}
    