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 <cstdio>
#include <iostream>
#include <iomanip>
#include <string>   
using namespace std;


 
int main(){
	int in[2],a,b,ans[2],i = 1,n,stop = 1;
	while(cin >> in[0] >> in[1]){
		a = in[0];
		b = in[1];
		if(a >= b){
			while(a >= 0){
				if(in[0] % a == 0 and in[1] % a == 0){
					ans[0] = a;
					break;
				}
				a--;
			}
		}else if(b >= a){
			while(b >= 0){
				if(in[0] % b == 0 and in[1] % b == 0){
					ans[0] = b;
					break;
				}
				b--;
			}
		}else{
			ans[0] = 1;
		}
		cout << ans[0] << endl;
		a = in[0];
		b = in[1];
		ans[1] = 1;
		n = 1;
		i = 1;
		while(i <= a or i <= b and stop == 1){
		n = 1;
		cout << " << i = " << i << endl;			
			while(i >= n){
				cout << "n = " << n << endl;
				if(a * i == b * n){
					ans[1] = a * i;
					stop = 0;
					break;
				}
				n++;
			}
		
		i++;
		}
		stop = 1;
		cout << ans[1] << endl;
		
	}
}

C++: #include <stdio.h>

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

int lcm(int a, int b){
	if ((a==0)||(b==0)){
		return 0;
	}
	return ((a / gcd(a, b)) * b);
}

int main(void){
	int a,b,x,y;
	while(scanf("%d %d",&a,&b)!=EOF){
		x=gcd(a,b);
		y=lcm(a,b);
		printf("%d %d\n",x,y);
	}
}

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

long gcd(long a, long b){
	if (a % b == 0){
		return b;
	}
	else {
		return (gcd(b, a%b));
	}
}
long lcm(long a, long b){
	long gc = gcd(a,b);
	long x = a*b;
	x = x / gc;
	return x;

}

int main(){
	long a,b;
	while (cin >> a >> b){
		long gc = 0;
		if (a >= b){
			gc = gcd(a, b);
		}
		else{
			gc = gcd(b,a);
		}
		long lc = 0;
		if (a >= b){
			lc = lcm(a, b);
		}
		else{
			lc = lcm(b,a);
		}
		cout << gc << " " << lc << endl;

		

	}



	return 0;
}

C++: #include <stdio.h>

typedef long long ll;

ll gcd(ll a,ll b)
{
	return b==0?a:gcd(b,a%b);
}

int main()
{
	ll a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF)
	{
		ll _gcd = gcd(a,b);
		printf("%lld %lld\n",_gcd,a*b/_gcd);
	}
}

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>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <cmath>
#include <cfloat>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define INF 1<<25

using namespace std;


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

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

int a, b;

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

	return 0;
}

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

int main(){
		int a, b;
		while(cin >> a >> b){
				int gcd;
				vector<int> divisor_a;
				vector<int> divisor_b;
				for(int i = 2; i <= a; i++){
						if(a % i == 0) divisor_a.push_back(i);
				}
				for(int i = 2; i <= b; i++){
						if(b % i == 0) divisor_b.push_back(i);
				}
				for(int i = 0; i < divisor_a.size(); i++){
						for(int j = 0; j < divisor_b.size(); j++){
								if(divisor_a[i] == divisor_b[j]) gcd = divisor_a[i];
						}
				}
				int lcm = a / gcd * b;
				cout << gcd << " " << lcm << endl;
		}
		return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define Vi vector<int>
#define FOR(i,s,e) for (int i=s; i<e; i++)
#define ITER(v) v.begin(), v.end()

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

    int64_t a, b;
    int64_t gcd;
    int64_t minval;
    bool iscoprime;

    while (true) {
        cin >> a >> b;
        if (cin.eof()) { break; }
        gcd = 1;
        while (true) {
            iscoprime = true;
            minval = min(a,b);
            FOR(i,2,minval+1) {
                if (a % i == 0 && b % i == 0) {
                    a /= i;
                    b /= i;
                    gcd *= i;
                    iscoprime = false;
                    break;
                }
            }
            if (iscoprime) { break; }
        }
        cout << gcd << " " << gcd * a * b << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b,s,m,ta,tb,tmp;
	while(cin>>a>>b){
	ta=a,tb=b;
	s=0,m=0;
	if(a<b)swap(a,b);
	else 
	while(true){
		if(a==0||b==0)cout<<"a#";
		tmp=a;
		a=b;
		b=tmp%a;
		if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
	}
}

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

using namespace std;

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 <iostream>
#include <algorithm>
using namespace std;

long gcd(long a, long b){
    if(a < b){
        swap(a, b);
    }else{
        while(b > 0){
            long r = a % b;
            a = b;
            b = r;
        }
    }
    return a;
}

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

C++: #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;
        }
    }
    return 0;
}

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


int gcd(int a, int b)
{
	return a%b == 0 ? b : 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++: #include <iostream>
#include <vector>
using namespace std;

struct xy
{
	long long x;
	long long y;
};

int getGCD(int a, int b) {
	if (b != 0)
		return getGCD(b, a%b);
	else
		return a;
}
int main()
{
	int a, b;
	vector<xy> dst;
	while (cin >> a >> b ) {
		int GCD = a > b ? getGCD(a, b) : getGCD(b, a);
		long long LCD = long long(a) * long long(b) / long long(GCD);
		dst.push_back({ GCD ,LCD });
	}
	for (vector<xy>::iterator it = dst.begin(); it < dst.end(); it++)
		cout << (*it).x << " " << (*it).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;
		double product;
		std::cin >> x >> y;
		if(std::cin.eof())
			break;
		product = (double)x*y;
		//ユークリッドの何とか
		while(x && y){
			if(x>y)
				x = x % y;
			else
				y = y % x;
		}
		std::cout << (int)MAX(x,y) << " " << (int)(product/MAX(x,y)) << std::endl;//確かGCD*LCMと元の積は等しいはず。
	}
	return 0;
}

C++: #include<cstdio>

int main() {
	int a, b,c,A,B;

	while (scanf("%d %d", &a, &b) != EOF) {
		A = a;
		B = b;
		while (b != 0) {
			c = a%b;
			a = b;
			b = c;
		}
		printf("%d %d\n", a, A / a*B);
	}
	return 0;
}