#include<iostream>
using namespace std;

int main()
{
	int a, b;
	int c, d;
	int i = 2;
	int j = 2;
	cin >> a >> b;
	c = a;
	d = b;
	
	while(c != d){
		if(c < d){
			c = a * i;
			i++;
		}else if(c > d){
			d = b * j;
			j++;
		}
	}
	
	/**********************************/
	
	int e, f;
	int k = 2;
	int l = 2;
	e = a;
	f = b;
	
	while(e != f){
		if(e > f){
			e = a / k;
			k++;
		}else if(e < f){
			f = b / l;
			l++;
		}
	}
	
	
	cout << e << " " << c << endl;
	
	return 0;
}