https://www.codechef.com/problems/FLOW016

```
#include <iostream>
int gcd(int a, int b)
{
if(a==0)
return b;
return gcd(b%a,a);
}
int lcm(int a, int b)
{
return (a*b)/gcd(a,b);
}
int main()
{
int t;
std::cin >> t;
while(t--)
{
int a,b;
std::cin >> a >> b;
std::cout << gcd(a,b) << " ";
std::cout << lcm(a,b) << " ";
std::cout << '\n';
}
return 0;
```

}