Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Printf("%d %d\n", y, lcm/y)
	}
}

C++: #include <bits/stdc++.h>
// #include "bits/stdc++.h"

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };
 
typedef long long ll;
using namespace std;
 
int main() {
  int a,b;
 
  while(cin >> a >> b){
    int g = __gcd(a,b);
    cout << g << " " << a/g*b << endl;
  }
  return 0;
}

C++: //先辗转相除找gcd再通过gcd求lcm
#include <bits/stdc++.h>

using namespace std;

long long a,b;

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

int main()
{
	while(scanf("%lld%lld",&a,&b)!=EOF)
	{
		long long yin=gcd(a,b);
		long long ax=a/yin,bx=b/yin;
		printf("%lld %lld\n",yin,ax*bx*yin);
	}
	return 0;
}

C++: #include <iostream>
 
using namespace std;
 
int GCD(int a, int b)
{
    if(a % b == 0) { return b; }
 
    if(b % a == 0) { return a; }
 
    if(a > b) { return GCD(a % b, b); }
 
    if(a < b) { return GCD(a, b % a); }
}
 
int LCM(int a, int b)
{
    return a / GCD(a, b) * b;
}
 
int main()
{
    int a, b;
 
    while(cin >> a >> b)
    {
int n=GCD(a,b);
        cout << n << ' ' << a/n*b << endl;
    }
 
    return 0;
}

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

int main(){
	long long a,b;
	while(cin >> a >> b){
		cout << __gcd(a,b) << " " << a/__gcd(a,b)*b << endl;
	}
}

C++: #include<cstdio>
#include<iostream>
#include <algorithm>

using namespace std;

int main() {
	int  a, b;
	while (cin >> a >> b) {
		cout << __gcd(a, b) << " " << a / __gcd(a, b) * b << endl;
	}

}

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

const int maxn = 1e7+7;
const int INF=0x3f3f3f3f;
typedef long long LL;
LL gcd(LL a,LL b){
return b==0?a:gcd(b,a%b);
}

int main(){

LL a,b;
while(scanf("%lld%lld",&a,&b)!=EOF){
    LL g=gcd(a,b);
    LL lcm=a*b/g;
    printf("%lld %lld\n",g,lcm);
}

return 0;
}

C++: #include<stdio.h>

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

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

int main(){
  int x, y;
  while(scanf("%d%d", &x, &y) != EOF){
    printf("%d %d\n", gcd(x, y), lcm(x, y));
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    long int a,b,lcm=0,r,x,y,count=0;
    while(cin>>a>>b){
        count++;
        if(count==50)break;
        x=a;
        y=b;
        while(1){
        r=a%b;
        a=b;
        b=r;
        if(r==0)break;
        }
        lcm=a;
    cout<<lcm<<" "<<x*y/lcm<<endl;
}
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int gcd(int a,int b){
  return b?gcd(b,a%b):a;
}

int main(void){

  int a,b;

  cin >> a >> b;

  int res=gcd(a,b);
  cout << gcd(a,b) << " " << a/res*b << endl;

  return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream> 
#include <numeric>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std; 
int main(){
	int a, b, r, x, temp;
	cin >> a >> b;
	x = a*b;
	if (a<b)
	{
	temp = a;
	a = b;
	b = temp;
	}
	r = a%b;
	while (r!=0)
	{
	a = b;
	b = r;
	r = a%b;
	}
	cout << b << " " << x/b << endl;
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int a, b;
	while(scanf("%d%d", &a, &b) != EOF){
		int sa = a, sb = b;
		int c;
		while(b){
			c = a % b;
			a = b;
			b = c;
		}
		printf("%d %d\n", a, sa / a * sb);
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int gcd(int a,int b){
	if(b>a)	swap(a,b);
	while(a%b!=0){
		int tmp=a%b;
		a=b;	b=tmp;
	}
	return b;
}
int main(){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		int g=gcd(a,b);
		cout<<g<<" "<<a/g*b<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	long long int a = 0;
	long long int b = 0;
	long long int c = 0;
	long long int d = 0;
	long long int e = 0;
	cin >> a;
	cin >> b;
	c = a;
	d = b;
	if (c < d)
	{
		long long int i = 0;
		i = d;
		d = c;
		c = i;
	}
	while (1)
	{
		e = c % d;
		if (e == 0)
		{
			break;
		}
		c = d;
		d = e;
	}
	cout << d << " " << a / d * b << endl;
	
	return 0;
}

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

int main()
{
	int a, b;
	int c, d;
	int i = 2;
	int j = 2;
	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>

using namespace std;

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

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

	if(a > b) { return GCD(a % b, b); }

	if(a < b) { return GCD(a, b % a); }
}

int LCM(int a, int b)
{
	return a / GCD(a, b) * b;
}

int main()
{
	int a, b;

	while(cin >> a >> b)
	{
		cout << GCD(a, b) << ' ' << LCM(a, b) << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

long gcd(long a, long b) {
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	return gcd(b, a % b);
}

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

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

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int GCD(int x,int y)
{
	return y==0?x:GCD(y,x%y);
}
int a,b;
int main()
{
	while(~scanf("%d %d",&a,&b))
	{
		if(a<b)
			swap(a,b);
		printf("%d %d\n",GCD(a,b),a/GCD(a,b)*b);
	}
}

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

int gcd(int a, int b){
  //a < b ユークリッドの互除法
  if(a==0) return b;
  return gcd(b%a,a);
}

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

C++: #include <iostream>

using namespace std;

int main(){

	long a,b,c,d;

	while(cin>>a>>b){
		c=a;
		d=b;
		while(1){
			if(c>d)c=c-d;
			if(c<d)d=d-c;
			if(c==d){
				cout<<c<<" "<<a*b/c<<endl;
				;break;}
		}}
		


return 0;
}

C++: #include<stdio.h>


int Kouyakusu(int a,int d){

	if((a==0)||(d==0))
		return 0;
	

	while(a != d){

		if(a > d)
			a-=d;
		else
			d-=a;
	}

	return a;

}

int main(void){

	long int a,b;

	long int yaku;

	for(int i=0;i<2;i++){
	scanf("%d %d",&a,&b);

	yaku = Kouyakusu(a,b);

	if(yaku != 0)
		printf("%d %d\n",yaku, (a/yaku)*b);
	else
		printf("0 0\n");

	}
	return 0;

}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	long long a = 0;
	long long b = 0;
	while(cin >> a >> b)
	{
		long long GCD = 0;
		long long LCM = 0;
		if(a < b)
			swap(a,b);
		long long temp = a * b;
		while(a % b != 0)
		{
			long long t = a % b;
			a = b;
			b = t;
		}
		LCM = b;
		GCD = temp / LCM;
		cout << LCM << " " << GCD <<endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
	double a, b, c, d;
	while(cin >> a >> b) {
		c = a;
		d = b;
		while (1) {
			if (fmod(max(a, b), min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a  = fmod(a,b);
			}else b = fmod(b,a);
		}
			cout << " " << c * d / min(a,b) << endl;
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

int gcd(int a,int b){
  
  return b>0 ? gcd(b,a%b):a;

}

int lcm(int a,int b){

  return a/gcd(a,b)*b;

}

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