#include<iostream>
#include<vector>
using namespace std;

int main(){
	long long a,b;
	while(cin >> a >> b){
		vector<int> num;
		int k = 0;
		long long max = 1;
		for(int i = 2; i < a/2; i++){
			if(a % i == 0){
				num.push_back(i);
				k++;
			}
		}
		for(int i = 0; i < k; i++){
			if(b % num[i] == 0){
				max = num[i];
			}
		}
		long long min = (a * b) / max;
		cout << max << " " << min << endl;
	}
	return 0;
}