#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
	int a, b;
	while (cin >> a&&cin >> b) {
		int min, max;
		int ans1, ans2;
		if (a > b) {
			min = b;max = a;
		}
		else {
			min = a;max = b;
		}
		for (int i = min;i >= 1;i--)
		{
			if (a%i == 0 && b%i == 0)
			{
				ans1 = i;
				break;
			}
		}
		for (int i = max;;i++)
		{
			if (i%a == 0 && i%b == 0)
			{
				ans2 = i;
				break;
			}
		}
		cout << ans1 << " " << ans2 << endl;
	}
	return 0;
}