#include <iostream>
using namespace std;

int main(){
	int a, b;
	while(cin >> a >> b){
		int c = a, d = b, p1 = c, p2 = d;
		while(a%b != 0){
			int tmp = a;
			a = b;
			b = tmp%b;
		}
		while(c != d){
			if(c < d)
				c += p1;
			else
				d += p2;
		}
		cout << b << ' ' << c << endl;
	}
    return 0;
}
