Go: package main

import "fmt"

func main() {
	var a, b int
	var gcd, lcm int

	for {
		_, err := fmt.Scanf("%d %d", &a, &b)
		if err != nil {
			return
		}

		var big, small int
		// GCD
		if a > b {
			big = a
			small = b
		} else {
			big = b
			small = a
		}

		for {
			if big%small == 0 {
				gcd = small
				break
			} else {
				small, big = big%small, small
			}
		}

		// LCM
		lcm = a * b / gcd

		fmt.Println(gcd, lcm)
	}
}

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

using namespace std;

long long int find_GCD(long long int a, long long int b){
  long long int max = 0;
  for(int i=min(a, b)/2+1;i>0;i--){
    if(a%i==0 && b%i==0){
      max = i;
      break;
    }
  }
  return max;
}

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

}

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

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

int main() {
    ll q,w;
    while(cin>>q>>w) {
        ll c = gcd(q,w);
        cout << c <<" "<<q*w/c <<endl;
    }
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,aa,ba,i,x,y,bb;
	aa=1;
	ba=1;
	while(scanf("%d %d",&a,&b)!=EOF){
		x=a;
		y=b;
		if(b<a){
			while(1){
				if(aa==0){
					break;
				}
				aa=a%b;
				a=b;
				b=aa;
			}
			ba=x*y/a;
			printf("%d %d\n",a,ba);
		}
		else{
			while(1){
				if(aa==0){
					break;
				}
				aa=b%a;
				b=a;
				a=aa;
			}
			ba=x*y/b;
			printf("%d %d\n",b,ba);
		}
	}
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,g,x,y,L,i=0;
while(i>50){
cin>>a>>b;
a=x;b=y;
while(1){
  if(x<y){y-x;}
  else if(x>y){x-y;}
  else if(x==y){x=g;break;}
}
L=(a*b)/g;
  cout<<g<<" "<<L<<endl;
  ++i;
}
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<string>
#include<cstdio>
#include<stack>
#include<cmath>
#include<bitset>
#include<memory>
#include<utility>
using namespace std;
#define FOR(i,m,n) for(i=m;i<n;i++)
#define CLR(a,b) memset(a,b,sizeof(a))
#define ROF(i,m,n) for(i=m;i>=n;i--)
#define BUG cout<<"debug"<<endl;
#define RT return
#define BK break
#define HEAP priority_queue
#define SP " "
#define lowf(a,b,c) lower_bound(a,b,c)
#define upf(a,b,c) upper_bound(a,b,c)
typedef long long LL;
typedef vector<int> VI;
const int INF = 2147483647;
const int NEN = -INF - 1;
const LL LINF = 9223372036854775807;
LL gcd(LL a, LL b)
{
	return b ? gcd(b, a%b):a;
}
int main()
{
	LL a, b,c;
	while (cin >> a >> b)
	{
		c = gcd(a, b);
		cout << c << " " << a*b / c << endl;
	}
    return 0;
}

C++: 
#include<iostream>
using namespace std;
int main(){
  long long  a,b,c,A,B;
  while(cin>>a>>b){
    A=a;
    B=b;
    while(b!=0){
      c=a%b;
      a=b;
      b=c;
    }
    cout<<a<<' '<<A/a*B<<endl;
  }
  
}

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

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

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

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

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

int gcd(int u, int v) {
  int r;
  while (0 != v) {
    r = u % v;
	u = v;
	v = r;
  }
  return u;
}

int main(){
	int a,b;
	double x;
	while(scanf("%d",&a)!=EOF){
		cin>>b;
	cout<<gcd(a,b)<<" ";
	x=(double)a*b;
	//cout<<x<<endl;
	if(a<b){
		int tmp = a;
		a = b;
		b = tmp;
	}
	printf("%0.0f\n",x/(double)gcd(a,b));
	}
    return 0;
}

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

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

int gcd(int u, int v)
{
  int r, z;

    if(v > u)
    {
      z = u;
      u = v;
      v = z;
    }

  while((r = u%v) != 0)
  {
    u = v;
    v = r;
  }    
  return v;  
}


int main(void)
{
  int a, b, z;

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

  return 0;
}

C++: #include <bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
    int  i,a,b,c;
    while(cin>>a>>b){
        if(a==b){
            cout<<a<<" "<<a<<endl;
        }
        else{
        if(a<b){
            i=b-a;
        }
        else{
            i=a-b;
        }
    for( int j=i;j>0;i-=2){
        if(a%i==0 && b%i==0){
            c=i;
            break;
        }
    }
    cout<<c<<" "<<a*b/c<<endl;
        }
    }
    re

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

int main()
{
	long int a, b;
	while (cin >> a >> b)
	{
		if (a < b) swap(a, b);
		//?????§??¬?´???°
		for (int i = 1; i <= a; i++)
		{
			if (a % i == 0 && b % (a / i) == 0)
			{
				cout << a / i << " ";
				break;
			}
		}
		//????°???¬?????°
		for (int i = 1; i <= b; i++)
		{
			if ((a * i) % b == 0)
			{
				cout << a * i << endl;
				break;
			}
		}
	}

	return 0;
}

C++: // B.cpp

#include <iostream>
#include <cmath>

using namespace std;

int gcd(int, int);
signed long int lcm(signed long int, signed long int);

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

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a < b){
		max = b, min = a;
	}
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
signed long int lcm(signed long int a, signed long int b) {
	signed long int max, min, res;
	res = 1;
	if(a > b){
		max = a, min = b;
	}
	if(a < b){
		max = b, min = a;
	}
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return a * b / max;
}

C++: #include <iostream>

#include <algorithm>


using namespace std;
int main()
{

double x,y,n,a,b;

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

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 = x % y;
			else
				y = y % x;
		}
		std::cout << (int)x << " " << (int)(product/x) << std::endl;//確かGCD*LCMと元の積は等しいはず。
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main() {
  int a, b, m, tmp_a, tmp_b;
  while (cin >> a >> b) {
    tmp_a = a;
    tmp_b = b;
    while (tmp_a != 0 && tmp_b != 0) {
      if (tmp_a > tmp_b) {
        tmp_a = tmp_a % tmp_b;
      } else {
        tmp_b = tmp_b % tmp_a;
      }
    }
    m = max(tmp_a, tmp_b);
    if (m == 0) {
      printf("%d %d\n", 0, 0);
    } else {
      printf("%d %d\n", a * b / m, m);
    }
  }
  return 0;
}