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 count == 51 {
			break
		}
		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++: import java.util.*;

class Main {
	public static int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNext()) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			int g = gcd(a, b);
			System.out.println(g + " " + a / g * b);
		}
	}
}

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

int main()
{
	long int a,b,i,min,max,x,y; //x最大公約数 y最小公倍数

	while(cin>>a>>b){
		x=y=0;
		if(a<b){
			min=a; max=b;
		}else{
			max=a; min=b;
		}

		for(i=2,x=0 ;x==0 ;i++){
			if(min%i==0 && max/(min/i)==0) x=i;
		}
		for(i=max,y=0 ;y==0 ;i+=max){
			if(i%min==0) y=i;
		}

		cout<<x<<" "<<y<<endl;
	}
}

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

typedef long long i64;

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

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

  int a, b;
  while(cin >> a >> b, !cin.eof()) cout << gcd(a, b) << " " << lcm(a, b) << endl;
}

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

int main() {
	double a, b, c, d, i;
	while(1) {
		cin >> a >> b;
		c = a;
		d = b;
		while (1) {
			if (a == b) {
				cout << a;
				break;
			}else if(a > b) {
				a -= b;
			}else b -=a;
		}
			cout << " " << c * d / a << endl;
	}

	return 0;
}

C++: #include<stdio.h>
int main(){
	long long int a,b,x,y;
	scanf("%lld%lld",&a,&b);
	x=a;
	y=b;
	while(a!=b){
		if(a>b){
			a-=b;
		}
		else{
			b-=a;
		}
	}
	printf("%lld %lld\n",a,x/a*y);
	return 0;
}

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

int main(){
	long long unsigned int a, b, r, gcd, lcm, x, y;
	while(cin >> a >> b){
		r = 1; x = a; y = b;
		while(r != 0){
			r = x % y;
			x = y;
			y = r;
		}
		gcd = x;
		lcm = a * b / gcd;

		cout << gcd << ' ' << lcm << endl;
	}
}

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

int main() {
	int c, d;
	while(cin >> c >> d){
		int a=0, b=0, gcd;
		long int lcm;
		a += c;
		b += d;
		if(a<b){
			int tmp = a;
			a = b;
			b = tmp;
		}
		int r = a % b;
		while(r != 0){
			a = b;
			b = r;
			r = a % b;
		}
		gcd = b;
		lcm = c/gcd*d;
		cout << gcd << ' ' << lcm << endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#define esp 1e-8
using namespace std;
typedef long long ll;
int n,k;
double a[10005];
int main()
{
    ll a,b;while(cin>>a>>b)
    {
        ll gcd=__gcd(a,b);
        ll lcm=a*b/gcd;
        cout<<gcd<<" "<<lcm<<endl;
    }
}

C++: #include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
long long gcd(long long a,long long b)
{
	long long c;
	while (a%b!=0) {
		c=a%b;
		a=b;
		b=c;
	}
	return b;
}
int main()
{
	//freopen("GCDLCM.in","r",stdin);
	//freopen("GCDLCM.out","w",stdout);
	long long a,b,maxy,minb;
	while (cin>>a>>b) {
		maxy=gcd(a,b);
		minb=a*b/maxy;
		cout<<maxy<<" "<<minb<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

void keisann(int a, int b) {
	long long ac = a;
	long long bc = b;
	bool d = true;
	do {
		a = a%b;
		if (a == 0) {
			cout << b << " ";
			cout << ac*bc/ b << endl;
			d = false;
			continue;
		}
		b = b%a;
		if (b == 0) {
			cout << a << " ";
			cout << ac*bc / a << endl;
			d = false;
			continue;
		}
	} while (d == true);
}

int main()
{
	int a, b;
	while (cin >> a>>b) {
		if (a > b) { keisann(a, b); }
		else if (a < b) {
			int c = a;
			a = b;
			b = c;
			keisann(a, b);
		}
		else if (a == b) {
			cout << "1" << " " << a << endl;
		}
	}
	return 0;
}

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

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

int main() {
	int a,b,c,e,f;
	while(cin>>a>>b){
		int g=0,l=0;
		e=a;
		f=b;
		if(e>f){
			e=e-f;
		}
	    if(f>e){
	    	f=f-e;
	    }
	    if(f==e){
	    	l=e;
	    }
	    if(l!=0)break;
		cout<<l<<" "<<a*b/l<<endl;
	    }
	return 0;

C++: #include<iostream>

using namespace std;

int main(){
    long a, b;
    while (cin >> a >> b)
    {
        long A = a, B = b;
        while (a != b)
        {
            if (a > b){
                a = a - b;
            }
            else{
                b = b - a;
            }
        }
        long gcd = A / a*B;
        cout << a << " " << gcd << endl;
    }

    return 0;
}

C++: #include <iostream>
 
//?????§??¬?´???°????±???????????????°??????(m >= n)
int calcGcd(int m, int n);
//????°???¬?????°????±???????????????°??????
inline int calcLcm(int m, int n, int gcd);
 
int main(){
    int gcd, lcm, x, y;
     
    while(std::cin >> x >> y){
        if(x > y) gcd = calcGcd(x, y);
        else gcd = calcGcd(y, x);
        lcm = calcLcm(x, y, gcd);
         
        std::cout << gcd << " " << lcm << std::endl;
    }
     
    return 0;
}
 
int calcGcd(int m, int n){
    return n == 0 ? m : calcGcd(n, m%n);
}
 
inline int calcLcm(int m, int n, int gcd){
    return m / gcd * n;
}

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

int gcd(int a, int b);

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

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

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

using namespace std;

int main()
{
	int a, b, r, c, d;
	int ta, tb;
	int i = 0;

	scanf("%d %d", &a,& b);
	ta = a;
	tb = b;

	while (1) {
	r = ta % tb;
	if (r == 0) break;
	ta = tb;
	tb = r;
	}
	c = tb;

	
	d = a * (b  / c);

	printf("%d %d\n", c, d);

	return (0);
}

C++: #include <iostream>

using namespace std;

typedef long long ll;

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

ll lcm(int a,int b){
	int table[2][100000];
	for(int i = 0; i < 2; i++)
		fill(table[i],table[i]+100000,0);
	// 1ÍÇ¿çÌà1Â¾¯Â
	table[0][1] = 1;
	table[1][1] = 1;

	int t_a=a;
	for(int i = 2; i*i <= t_a; i++){
		while(t_a % i == 0){
			table[0][i]++;
			t_a/=i;
		}
	}
	if(table[0][t_a] == 0)
		table[0][t_a]=1;

	int t_b=b;
	for(int i = 2; i*i <= t_b; i++){
		while(t_b % i == 0){
			table[1][i]++;
			t_b/=i;
		}
	}
	if(table[1][t_b] == 0)
		table[1][t_b]=1;

	ll mul = 1;
	for(int i = 2; i <= 100000; i++){
		if(table[0][i] == 0 && table[1][i] == 0)
			continue;
		else{
			int mc = max(table[0][i],table[1][i]);
			for(int j = 0; j < mc; j++)
				mul *= i;
		}
	}
	return mul;
}

int main(){

	ll a,b;
	while(1){
		cin >> a >> b;
		if(cin.eof()){
			break;
		}
		cout << gcd(a,b) << " " << lcm(a,b) << endl;
	}

	return 0;
}

C++: #include <iostream>
 
using namespace std;
 
int gcd(int a, int b)
{
    if (a % b == 0) return b;
    return gcd(b, a % b);
} 

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

C++: #include <iostream>
using namespace std;
typedef unsigned long long int lli;

lli GCD(lli a,lli b);
lli LCM(lli a,lli b);

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

lli GCD(lli a,lli b){
    if(a<b)
        swap(a,b);
    lli r = 1;
    while(r!=0){
        r = a%b;
        a = b;
        b = r;
    }
    return a;
}

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