废话不多说
#include <stdio.h>
int gcd(int a,int b);int main(void)
{ int i,j,n,gcdd,lcm;
scanf("%d",&n);
while(n--)
{
scanf("%d %d",&i,&j);
gcdd=gcd(i,j);
lcm=i*j/gcdd;
printf("%d %d\n",gcdd,lcm);
}
return 0;
}
int gcd(int a,int b)
{
if (b==0) return a;
else return gcd(b,a % b);
}