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 MAX(x,y) ((x>y)?x:y)
#define MIN(x,y) ((x>y)?y:x)
int main(void)
{
	while(true)
	{
		int x=0,y=0,product;
		std::cin >> x >> y;
		if(std::cin.eof())
			break;
		product = x*y;
		//ユークリッドの何とか
		while(x!=y){
			if(x>y)
				x %=y;
			else
				y %=x;
		}
		std::cout << (int)x << " " << (int)(product/x) << std::endl;//確かGCD*LCMと元の積は等しいはず。
	}
	return 0;
}

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

using namespace std;

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

int main (int argc, char * const argv[]) {
    // insert code here...
    int a, b, c;
	while(cin >> a >> b){
		if(a<b){
			swap(a, b);
		}
		c = gcd(a, b);
		cout << c << " " << a/c*b << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,c,d,e;
	std::cin>>a>>b;
	d=a;
	e=b;
	if(b>a){
		d = a;
		a = b;
		b = d;
	}
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	}
std::cout<<a<<" "<<((e/a)*(d/a)*a);
}

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

#define MAX 256

int f(int x, int y){
	if (y == 0)return y;
	return f(y, x%y);
}

int main(void){
	
	long max[50], min[50];
	for (long i = 0; i < 50; i++){
		max[i] = 0;
		min[i] = 0;
	}

	long a, b;
	long i = 0;

	while (scanf("%d%d", &a, &b) != EOF){
		max[i] = f(a, b);
		long j = 1;
		while (min[i] == 0){
			if ((a*j) % b == 0)min[i] = a*j;
			j++;
		}
		i++;
	}

	for (long j = 0; j < i; j++){
		printf("%d %d\n", max[j], min[j]);
	}

	return 0;
}

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

int main(){
	long long a, b;
	long long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			x = x % y; 
			swap(x, y);
		}

		cout << y << " " << (a / y * b) << endl;
	}
}

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

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(1){
	
		int tmp=b;
		b=a%b;
		a=tmp;
		cout<<a<<b<<endl;
		if(b==0)break;
	}
	cout<<a<<" "<<ta*tb/a<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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


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

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;
using ll = long long;
const int MAXN = 5004;

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

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

C++: #include <iostream>

using namespace std;
typedef long long ll;
ll gcd(ll a,ll b)
{
    return b>0?gcd(b,a%b):a;
}
ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}
int main()
{
    ll a,b;
    while ((cin>>a>>b)>0)
    {
        ll GCD=gcd(a,b);
        cout<<GCD<<" "<<a/GCD*b<<endl;
    }
    return 0;
}

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

int gcd(int a,int b){
  if(b==0)
    return a;
  return gcd(b,a%b);
}
int lcn(int a,int b){
  int s,t;
  s = a/gcd(a,b);
  t = b/gcd(a,b);
  return gcd(a*t,b*s);

}
int main(){
  int a,b;

  while(cin >> a >> b){


    cout << gcd(a,b) << " " << lcn(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 main(){
	int a,b;
	while(cin >> a >> b){
		int gcd = a, lcm;
		while(a%gcd != 0 || b%gcd != 0) gcd--;
		lcm = (a\gcd)*(b\gcd)*gcd;
		cout << gcd <<" "<< lcm << endl;
	}
}

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

using namespace std;

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

C++: #include <iostream>

using namespace std;

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

int gcd2(int a,int b){
	int w;
	while(b != 0){
		w = a % b;
		a = b; b = w;
	}
	return a;
}

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

int main(void){
	int a,b;
	while(cin >> a >> b){
		cout << gcd2(a,b) << " " <<lcm(a,b) << "\n";//最大公約数
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<string>
typedef long long int ll;

using namespace std;


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

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

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

using namespace std;

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

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++: //AOJ0005
#include<iostream>
using namespace std;

int gcd(int n,int m){
	if(m==0)return n;
	gcd(m,n%m);
}
int main(){
	int n,m;
	while(cin>>n>>m){
		cout<<gcd(n,m)<<" "<<n*m/gcd(n,m)<<endl;
	}
	return 0;
}

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

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

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

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

int main()
{
  int a,b;
  while(cin >> a >> b){
    int GCD,LCM;
    int temp;
    if(a<b){
      temp = a;
      a = b;
      b = temp;
    }
    for(int i=1; i<=b; i++){
      if( b%i==0 && a%(b/i)==0 ){
	GCD = b/i;
	break;
      }
    }
    for(int i=1; i<=b; i++){
      if( (a*i)%b == 0 ){
	LCM = a*i;
	break;
      }
    }
    cout << GCD << " " << LCM << endl;
  }
  return 0;
}

C++: #include <iostream>
 
using namespace std;
 
int main(){
    long a,b;
    a=0;b=0;
    cin >> a >> b;
    if(a<b) {
        long c;
        c=a;
        a=b;
        b=c;
    }
    long answer;
    long d,e,f;
    for(;;){
         if(e==f){
             answer = a*b/f;
             break;
         }
         d=e-f;
         e=f;
         f=d;
    }
    cout<<f<<" "<<answer<<endl;
    return 0;
}

C++: #include <cstdio>
using namespace std;
long long int gcd(long long int m,long long int n)
{
	if (n == 0)
		return m;
	return gcd(n,m % n);
}

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