我们只需要记住a*b = gcd(a,b)*lcm(a,b)。
//gcd和lcm a*b = gcd(a,b)*lcm(a,b)
#include<iostream>
using namespace std;
using ll = long long;
const int N = 2e6 + 9;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; };//a/gcd(a,b)一定是一个整数,防止爆int
void slove()
{
ll a, b; cin >> a >> b;
cout << gcd(a, b) << " " << lcm(a, b) << '\n';
}
int main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int t; cin >> t;
while (t--)slove();
return 0;
}