Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

constexpr int gcd(int a, int b) {
  int c = 0;
  while (a) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}

constexpr int lcm(int a, int b) {
  return a * b / gcd(a, b);
}

void solve() {
  int a, b;
  while (cin >> a >> b) {
    cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
  }
}

C++: #include<stdio.h>

int main(void)
{
	long int x[1000],x2[1000],y[1000],y2[1000],z[1000],i=0,j=0,gcd[1000]={0},lcm[1000]={0};

	while(i!=-1)
	{
		scanf("%d %d",&x[i],&y[i]);		   
		x2[i] = x[i];
		y2[i] = y[i];
		if(x[i]<=0 || x[i]>2000000000 || y[i]<=0 || y[i]>2000000000)break;
	    i=i+1;
	}
	for(j=0;j<i;j++)
	{
		while(x[j] % y[j] !=0)
	   {
     	  z[j] = x[j] % y[j];
 		  x[j] = y[j];
 		  y[j] = z[j];
	   }
	   gcd[j]=y[j];

	   lcm[j] = x2[j] * (y2[j] / gcd[j]);
	   
	   printf("%d %d\n",gcd[j],lcm[j]);
	}
  return 0;
}

C++: #include <iostream>

using namespace std;

int _GCD(int a, int b);
int _LCM(int a, int b);

int main()
{
	int a, b;
	
	while (cin >> a >> b) {
		cout << _GCD(a, b) << " " << _LCM(a, b) << endl;
	}
	
	return 0;
}

int _GCD(int a, int b) {
	int r;
	
	if (a < b) {
		r = a; a = b; b = r;
	}
	
	do {
		r = a % b;
		a = b;
		b = r;
	} while (r != 0);
	
	return a;
}

int _LCM(int a, int b)
{
	return (a / _GCD(a, b)) * b;
}

C++: #include <iostream>

#include <algorithm>


using namespace std;
int main()
{

double x,y,n,a,b;

while(cin>>x>>y)
{
a=x;
b=y;
if(x>y)
while(x%y!=0)
{
n=x%y;
x=y;
y=n;
cout<<y<<" "<<a*b/y<<endl;
}
else
while(y%x!=0)
{
n=y%x;
y=x;
x=n;
cout<<x<<" "<<a*b/x<<endl;
}

}
return 0;
}

C++: #include<iostream>
typedef unsigned long long int ull;

using namespace std;
ull gcd(ull x1, ull x2){
  if(x1 == 0) { return x2; }
  if(x2 == 0) { return x1; }
  if(x1 > x2){
    return gcd(x1 % x2, x2);
  } else {
    return gcd(x1, x2 % x1);
  }
}
ull lcm(ull x1, ull x2){
  return x1 * x2 / gcd(x1, x2);
}

int main(){
  ull a, b;
  while(cin >> a >> b){
    cout << gcd(a,b) << " " << lcm(a,b) << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define int				long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define FORE( i, m, n ) FOR( i, m , n + 1 )
#define REP( i, n )     FOR( i, 0, n )
#define REPE( i, n )	FOR( i, 0, n + 1 )
#define FORR( i, m )	for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )	FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()             
#define MP( a, b )		make_pair( (a), (b) )
#define fi				first
#define se				second

template<class T>bool chmax( T& a, const T& b ) { if( a < b ) { a = b; return 1; } return 0; }
template<class T>bool chmin( T& a, const T& b ) { if( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

int gcd( int a, int b ) {
	if( b == 0 ) return a;
	return		 gcd( b, a % b );
}

signed main() {
	int x, y;
	while( cin >> x >> y ) {
		int a = gcd( x, y );
		cout << a << " " << x * y / a << endl;
	}
}

C++: #include<iostream>
using namespace std;

int main()
{
	int a, b;
	int c, d;
	int i = 2;
	int j = 2;
	
	while(cin >> a >> b)
	{
		c = a;
		d = b;
		
		while(c != d){
			if(c < d){
				c = a * i;
				i++;
			}else if(c > d){
				d = b * j;
				j++;
			}
		}
		
		/**********************************/
		
		int e, f;
		int k = 2;
		int l = 2;
		e = a;
		f = b;
		
		while(e != f){
			if(e > f){
				e = a / k;
				k++;
			}else if(e < f){
				f = b / l;
				l++;
			}
		}
		
		
		cout << e << " " << c << endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstdlib>
#include <math.h>
using namespace std;
 
const int MAX_N=10000;
unsigned long long int a,b;

unsigned long long gcd(unsigned long long a,unsigned long long b){
	if(b) return gcd(b,a%b);
	else return a;
}

unsigned long long lcm(unsigned long long a,unsigned long long b){
	return (a/gcd(a,b))*b;
}

int main(){
	while(cin >> a >> b){
		cout << gcd(a,b) << " " << lcm(a,b) << endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int gcd(int m ,int n){
	if(n==0) return m;
	else return(n,m%n);
}

int main(){
         long int a ,b ,g ,l;
		 while(scanf("%ld %ld",&a,&b)!=EOF){
			g = gcd(a,b);
			l = a/g*b;
			printf("%ld %ld\n",g,l);
		 }
		 return 0;
}

C++: #include <iostream>
using namespace std;

int gcd(int m,int n)
{
	if((m == 0) || (n == 0)) return 0;

	while(m != n)
	{
		if(m > n) m = m -n;
		else n = n -m;
	}

	return m;
}

int lcm(int m,int n)
{
	if((m == 0) || (n == 0)) return 0;
	return ((m / gcd(m,n)) * n);
}


int main()
{
	int a,b,c,x,y;
	while(cin >> a >> b)
	{
		cout << gcd(a,b) << " " << lcm(a,b)<< endl;
	}
	return 0;
}

C++: #include<stdio.h>



unsigned long int gcd(unsigned long int one,unsigned long int two){		//Ååöñ
	
	unsigned long int temp,mod;
	
	if(one<two){
		temp=one;
		one=two;
		two=temp;
	}
	
	while(two!=0){
		
		mod=one%two;
		
		if(mod==0){
			
			return two;
		
		}else if(mod!=0){
			one=two;
			two=mod;
		}
	}
	return 0;
}


unsigned long int lcm(unsigned long int one, unsigned long int two){		//Å¬ö{
	return (one/gcd(one,two))*two;
}
	
int main(void){

	unsigned long int first,second;
	

	while(scanf("%d %d",&first,&second)!=EOF){
		
		if(first<=0||second<=0){
			break;
		}
		printf("%d %d\n",gcd(first,second),lcm(first,second));
	}
	
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <math.h>

int u(int a, int b);
int l(int a, int b, int gcd);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b, gcd);
    std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(1){
    if(a==0) return b;
    if(b==0) return a;
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
}

int l(int a, int b, int gcd){
  return a * b / gcd;
}