#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>
#include <ctype.h>
using namespace std;
int n,p,q=2,nn,pp;
long long lcm=1;
int main(){
	while(cin>>n>>p){
		nn=n;pp=p;
		while(1){
			if(n%q==0&&p%q==0){
			n/=q;p/=q;lcm*=q;q=2;}else{
			q++;}
			if(q>n&&q>p){
			break;}

		}
			cout<<lcm<<" "<<nn/lcm*pp<<endl;
			q=2;lcm=1;
	}
    return 0;}
