#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<cmath>
using std::cout;using std::endl;
using std::cin;
int gcd(int a,int b,int c){
	int i=1;
	int r;
	while(true){
		if(a%i==0 && b%i==0)
			r=i;
		i++;
		if(i==a || i==b)
			break;
	}
	return r;
}
int main(){
  int n,m;
  while(cin>>n>>m){
	  cout<<gcd(n,m,n/2)<<" ";
	  cout<<(n/gcd(n,m,n/2))*(m/gcd(n,m,n/2))*gcd(n,m,n/2)<<endl;
  }
  return 0;
}