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<iostream>
#define nijuoku 2000000000

using namespace std;


int saidaikouyaku(__int64 a, __int64 b){
    int big    = max(a,b);
    int little = min(a,b);
    
    for(__int64 i = little; i > 1; --i){
        if(little % i == 0 && big % i == 0)return i;        
    }
    return -1;
}

int saisyoukoubai(__int64 a, __int64 b){
    
    int big    = max(a,b);
    int little = min(a,b);
    
    for(__int64 i = big; i < nijuoku; i += big){
        if(i % little == 0)return i;        
    }
    return -1;
};


            
int main(){

    __int64 a, b;
    
    while(cin >> a >> b){
        cout << saidaikouyaku(a,b) << ' ' << saisyoukoubai(a,b) << endl;
	}
	return 0;
}

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

int main(){
   int a = -1;int b = 0;int i = 1;int g = 0;int seki = 1;
	   cin >> a >> b >>;
          seki = a*b;
	if(a == -1){
		break;
		}
	if(a < b){
		i=a;
		a=b;
		b=i;
		}
for(i = 1;i <= 50;i++){
   
if(b == 1){
  g = a;
  break;
  }
else {
 a = a%b;
 i=a;
 a=b;
 b=i;
 }
}
cout >> g >> " " >> seki/g >> endl;

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  long long a,a2,b,b2,R,l;
  cin>>a>>b;
  a2=a;
  b2=b;
  while(1){
    if(b>a){
      R=b-a;
      if(a<R)b=R;
      else{ 
	b=a;
	a=R;
      }
    }
    else{
      R=a-b;
      if(a<R){
	b=a;
	a=R;
      }
      else{ 
	a=b;
	b=R;
      }
    }
    if(R==0)break;
      }
  cout<<a<< ' ';
  l=(a2*b2)/a;
  cout<<l<<endl;
  return 0;
}

C++: #include<stdio.h>

typedef unsigned long long ULL;

ULL gcd(ULL m,ULL n){
	
	return n==0?m:gcd(n,m%n);	
}
ULL lcm(ULL m,ULL n){
	
	return m/gcd(m,n)*n;
}

int main(){
	ULL a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF){
		printf("%lld %lld\n",gcd(a,b),lcm(a,b));
	}
	return 0;
}

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

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

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

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

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

C++: #include<stdio.h>

int main(void)
{
	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 main(void){
    long long a, b;
    while(cin >> a >> b){
        long long _a = a, _b = b;
        long gcd, lcm;

        while(a%b != 0){
            gcd = a%b;
            a = b;
            b = gcd;
        }
        lcm = (_a * _b)/gcd;
        cout << gcd << ' ' << lcm << endl;
    }
}

C++: #include<stdio.h>
#include<algorithm>
#include<string.h>
#include<vector>
#include<queue>
//aoj 0005
using namespace std;
int x,y;
int gcd(int a,int b)
{
	if(b==0)
	{
		return a;
	}else{
		return gcd(b,a%b);
	}
}
int lcm(int a,int b)
{
	return (long long)a*b/gcd(a,b);
}
int main()
{
	while(scanf("%d%d",&x,&y)!=EOF)
	{
		printf("%d %d\n",gcd(x,y),lcm(x,y));
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#include <vector>
using namespace std;
long long fpb(long long a, long long b){
	long long ret = 0;
	while(a % b != 0){
		ret = a % b;
		a = b;
		b = ret;
	}
	return b;
}
long long a, b;
int main(){
	while(cin >> a >> b){
		cout << fpb(a, b) << " " << (a*b)/fpb(a, b) << "\n";
	}
	return 0;
}

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

int gcd(int a, int b){

int p,q,r;
if(a<b){p=b;b=a;a=p;

}
   while((r=b%a)!=0){
   b=a;
   a=r;
   }
   return a;
}

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

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

typedef unsigned int uint;

uint func1(uint a,uint b){
    while(a != b){
        if(a>b)a-=b;
        else b-=a;
    }
    return a;
}

uint func2(const uint a,const uint b){
    uint a2=a,b2=b;
    while(a2 != b2){
        if(a2>b2)b2+=b;
        else a2+=a;
    }
    return (a2>=2000000000)?2000000000:a2;
}

int main(){
    uint a,b;
    while(cin >> a >> b){
        if(a>2000000000 || b>2000000000)return 0;

        cout << func1(a,b) << " " << func2(a,b);
    }
    return 0;
}

C++: #pragma warning(disable:4996)
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;

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

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

int main() {
	LL a, b;
	while (~scanf("%lld%lld", &a, &b)) {
		printf("%lld %lld\n", gcd(a, b), lcm(a, b));
	}

	return 0;
}

C++: #include<stdio.h>


int main(){
	long long int x,y;
	long long int i,j;
	while(scanf("%lld%lld",&i,&j)!=EOF){
		x=i,y=j;
		while(i==j){
			if(i>j){
				i=i-j;
			}else{
				j=j-i;
			}
		}
		y=x*y/i;
		x=i;


		printf("%lld %lld\n",x,y);
	}

	return 0;
}

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

using namespace std;

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

int main()
{
    while (~scanf("%d%d",&a,&b)) {
        printf("%d %d\n",gcd(a,b),a*b/gcd(a,b));
    }
    return 0;
}

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

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

int main(){
	int x[2];
	int max_kyk, min_kbi, a,b;
	while(cin>>x[0]>>x[1]){		
		sort(x, x+2);
		max_kyk = gcd(x[1], x[0]);
		min_kbi = (x[1]/max_kyk)*x[0];
		cout << max_kyk << ' ' << min_kbi << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int gcd(int,int);
int lcm(int,int);
int tes(int,int);

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

int gcd(int a,int b){
  int n;
  n=min(a,b);
  for(int i=n;i>=1;i--){
    if(a%i == 0 && b%i==0)return i;
  }

}
/*
int tes(int a,int b){
  if(b == 0)return a;
  return tes(b,a%b);
}
*/

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

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

double eucAlg(int a,int b);


int main(int argc, char* argv[])
{
	double a,b;	//??\??????
	double c, d;	//??????

	while(cin >> a >> b){

		c = eucAlg(a, b);

		d = a * b / c;
		cout << fixed << setprecision(0) << c << " " << d << endl;
	}
	return 0;
}

//??????????????????????????????
double eucAlg(
	int a,
	int b
	)
{
	double c;

	do
	{
		c = a % b;
		if(c == 0){
			break;
		}
		a = b;
		b = c;

	}while(1);

	return b;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
long long int sub(long long int x,long long int y);
int sort(long long int *a,long long int *b);
int main(){
long long int a,b,c,x,y;
 while(scanf("%lld %lld",&a,&b)!=EOF){
   c=a*b;
   sort(&a,&b);
   while(1){
     if(a==b)break;
     x=sub(a,b);
     sort(&b,&x);
     a=b;
     b=x;
   }
   y=c/b;
   printf("%lld %lld\n",b,y);
 }
}
long long int sub(long long int x,long long int y){
  return x-y;
}
int sort(long long int *a,long long int *b){
  if(*a<*b){
    long long int temp =*a;
    *a=*b;
    *b=temp;
  }
}

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