#include<stdio.h>

#define N 50

struct{int a,b;}d[N];

int main(){
    int i,j;
    int L;
    int a,b,large,saidai,saishou;

    for(i=0; i<N && scanf("%d %d",&d[i].a,&d[i].b)!=EOF; i++);
    L=i;

    for(i=0;i<L;i++){
        a=d[i].a; b=d[i].b;
        if(a>b)large=a;
        else large=b;
        for(j=1;j<=large;j++)
            if(a%j==0 && b%j==0)saidai=j;
        for(j=1;;j++)
            if(j%a==0 && j%b==0)
            {saishou=j; break;}
        printf("%d %d\n",saidai,saishou);
    }

    return 0;
}