#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, s, t;
	float tmp, tmp2;
	while(cin >> a >> b){
		for(int i = (a > b)? b : a; i >= 1; i--){
			tmp = (float)a/i;
			tmp2 = (float)b/i;
			if(tmp == (int)tmp && tmp2 == (int)tmp2){
				cout << i << " ";
				break;
			}
		}
		s = a;
		t = b;
		while(s != t){
			if(s > t){
				t += b;
			} else {
				s += a;
			}
		}
		cout << s << endl;
	}
	
	return 0;
}