Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(int x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

ll gcd (ll a, ll b) {
  if (a < b) swap(a, b);
  while (b > 0ll) {
    ll tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
};



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll a, b;
  while (cin >> a >> b) {
    ll g = gcd(a, b);
    ll l = a / g;
    l *= b;
    cout << g << " " << l << 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 main(){
  int a,b;
  cin>>a>>b;

  int ans1 = gcd(a,b);
  cout<<ans1<<" "<<a/ans1*b<<endl;
  return 0;
}

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

int main() {
	int a, b, c, d, e, f, g, l;
	while (cin >> a >> b) {
		c = a; d = b;
		e = a; f = b;
		while (1) {
			if (a > b) {
				a %= b;
				if (a == 0) { g = b; break; }
			}
			else if (a<b) {
				b %= a;
				if (b == 0) { g = a; break; }
			}
		}
		while (1) {
			if (c>d) d += f;
			else if (c < d) c += e;
			if (c == d) { l = c; break; }
		}
		cout << g << " " << l << endl;
	}
}

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);
}