Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	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
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

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

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

 GCD(b, a%b);
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define repp(i,n) for(int i=1; i<n; i++)
#define int long long
using namespace std;
int Max(int n, int m){
  vector<int> v1;
  vector<int> v2;
  repp(i,n){
    if(n%i == 0) v1.push_back(i);
    if(m%i == 0) v2.push_back(i);
  }
  int t=0;
  rep(i,v1.size()){
    rep(j,v2.size()){
      if(v1[i] == v2[j] && t < v2[j]) t = v2[j];
    }
  }
  return t;
}
signed main(){
  int n,m;
  while(cin >> n >> m){
    int a = Max(n,m);
    int b = n/a*m;
    cout << a << " " << b << endl;
  }
  return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	int a,b;
	while(cin>>a>>b){
		int lcm, gcd;
		
		for(int i=min(a,b); i>=1; i--){
			if(!(a%i) && !(b%i)){
				gcd = i;
				break;
			}
		}
		lcm = a * (b / gcd);		//()必要。intの範囲のため
		
		cout<< gcd<< " "<< lcm<< endl;
	}

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = min(temp_a, temp_b);
		cout << gcd << " ";

		lcm = a * b / gcd;
		cout << lcm << endl;

	}

	//getchar();

	return 0;
}

C++: include <iostream>
#include <vector>
using namespace std;
int main() {
 int a,b,c,x,y;
 vector<int> lc,gc;
 while(cin >> a >> b) {
 x=a; y=b;
 while( a % b!=0) { c=b; b=a % b; a=c; }
 lc.push_back(b); y=y/b; gc.push_back(y*x);
 }
 for (c=0;c<lc.size();c++) cout << lc[c] << " " << gc[c] << endl; 
 return 0;
}

C++: #include<stdio.h>

#define N 50

struct{int a,b;}d[N];

int main(){
    int i,j;
    int L;
    int a,b,large,saidai,saishou;

    for(i=0; i<N && scanf("%d %d",&d[i].a,&d[i].b)!=EOF; i++);
    L=i;

    for(i=0;i<L;i++){
        a=d[i].a; b=d[i].b;
        if(a>b)large=a;
        else large=b;
        for(j=1;j<=large;j++)
            if(a%j==0 && b%j==0)saidai=j;
        for(j=1;;j++)
            if(j%a==0 && j%b==0)
            {saishou=j; break;}
        printf("%d %d\n",saidai,saishou);
    }

    return 0;
}

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

inline u_long lcm(u_long a, u_long b) {
    return a * b / std::__gcd(a, b);
}

int main(void) {
    u_long a, b;

    while (std::cin >> a >> b) {
        std::cout << std::__gcd(a, b) << " " << lcm(a,b) << std::endl;
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int a,b,r,G,R,L,tmp;
  while(cin >> a >> b){
    R = a; L = b;
    if(b > a){
      tmp = a; a = b; b = tmp;
    }
    while(1){
      r = a % b;
      if(r == 0)
        break;
      a = b;
      b = r;
       }
    G = b;
    R = R / G;
    L = L / G;
    cout << G <<" "<< R*L*G << endl;
  }
}

C++: #include<cstdio>
long int GCD(long int a,long int b){
	if(a < b){
		long int bf = a;
		a = b;
		b = bf;
	}
	while(b != 0){
		long int mod = a % b;
		a = b;
		b = mod;
		//printf("mod = %ld\n",mod);
	}
	return a;
}

int main(){
	long int a,b;
	while(scanf("%ld %ld",&a,&b) != EOF){
		long int gcd = GCD(a,b);
		long int lcm = (a/ gcd) * b;
		printf("%ld %ld\n",gcd,lcm);
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int x, int y);  // ?????§??¬?´???°????±?????????¢??°
int lcm(int x, int y);  // ????°???¬?????°????±?????????¢??°

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

	return 0;
}

// ?????§??¬?´???°????±?????????¢??°
int gcd(int x, int y)
{
	int r;

	if (x == 0 || y == 0)  // ?????°?????§??????
	{
		fprintf(stderr, "?????°??¨????????§??????\n");
		return 0;
	}

	// ????????°?????????????????????
	while ((r = x % y) != 0) // y??§????????????????????§?????????
	{
		x = y;
		y = r;
	}
	return y;
}

// ?????§??¬?´???°????±?????????¢??°
int lcm(int x, int y)
{
	if (x == 0 || y == 0)  // ?????°?????§??????
	{
		fprintf(stderr, "?????°??¨????????§??????\n");
		return 0;
	}

	return (x * y / gcd(x, y));
}

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

long long int GCD(long long int a, long long int b) {
    return (a == b) ? a : GCD(b % a, a);
}

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

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

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

int main(void)
{
	long long num1, num2, G, L, ans1, ans2;

	while (cin >> num1 >> num2) {
		L = num1;
		ans1 = num1; ans2 = num2;
		for (long long i = 2; i < num1 && i < num2; i++) {
			if ((num1 % i) == 0 && (num2 % i) == 0) G = i;
			while ((ans1 % i) == 0 && (ans2 % i) == 0) {
				G = i;
				ans1 /= i;
				ans2 /= i;
			}
		}
		cout << G << " " << L*ans2 << endl;
	}
	return 0;
}

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

int main(){
	int a, b, r, gcd, lcm, x, y;

	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r = x % y){
			x = y;
			y = r;
		}
		gcd = y;
		lcm = a * b / gcd;

		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

int gcd(int a, int b) {
  int r;
  while (r = a % b) {
    a = b;
    b = r;
  }
  return b;
}

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

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

int main()
{
	int x, y;
	while (~scanf("%d%d", &x, &y)){
		int gcd = __gcd(x, y);
		printf("%d %d\n", gcd, x / gcd * y);
	}
}

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

int64_t gcd(int64_t a, int64_t b){
  while(a % b != 0){
    int64_t tmp = a % b;
    a = b;
    b = tmp;
  }
  return b;
}

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

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

int gcd(int x,int y){
  if(x%y==0) return n;
  else{
    int z=x%y
    return gcd(y,z);
  }
}

int main()
{
  int a,b;
  int g;
  long int l;
  cin >> a >> b;
  
  if(a>b) g=gcd(a,b);
  else if(a<b) g=gcd(b,a);
  else g=a;

  l=a*b/g;
  cout << g << " " << l << " " << endl;

  return 0;
}

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