Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

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

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

signed main(){
	int a,b;
	while(cin>>a>>b){
		o(gcd(a,b)<<" "<<lcm(a,b));
	}
}

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


int gcd(int a, int b){ return a%b ? gcd(b, a%b) : 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<algorithm>
using namespace std;

int main(){
	int x[2], k = 1, a, b;
	
	while(cin >>x[1]>>x[2]){
		if(x[2] > x[1]) swap(x[1], x[2]);
		a = x[1];
		b = x[2];
		while(x[3 - k] != 0){
			x[k] = x[k] % x[3 - k];
			k = 3 - k;
		}
		cout <<x[k]<<" "<<a / x[k] * b<<endl;
		k = 1;
	}
	
	return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	ll a,b;
	while(cin >> a >> b){
		ll gcd = __gcd((int)a,(int)b);
		ll lcm = a/gcd*b;

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

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

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define mp1(a,b,c) P1(a,P(b,c))
#define pque(a) priority_queue<a>
#define rpque(a) priority_queue<a,vector<a>,greater<a>>

const int INF=1000000000;
const int dre_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dre_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
const int kaijou[10]={1,1,2,6,24,120,720,5040,40320,362880};

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

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

C++: #include <string>
#include <vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

using namespace std;


    long long g(long long a,long long b){

	int r=max(a,b)%min(a,b);
	if(r==0)  return min(a,b);
	else return g(min(a,b),r);
}

int main(){

	long long a,b;

	while(1){

	cin >> a >> b;

	if(cin.fail()) break;

	cout << g(a,b) << " " << (a*b)/g(a,b) << endl;

	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include <algorithm>
#include <functional>
#include<cmath>
#include<numeric>

#define lcm(a, b, c) (a*b)/c

using namespace std;

int gcd(int max , int min){
int amari;
while(1)
{
amari=max%min;
if(amari==0) return min;
max=min;
min=amari;
}
}

int main(){
	int a,b;
	while(cin>>a>>b)
	{
		int saidai,saisyou;
		long long int kari=0;
		saidai = gcd( max(a,b) , min(a,b) );
		kari = b/saidai;
		saisyou =kari*a;

		cout<<saidai<<" "<<saisyou<<endl;
	}

	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int x,y,p,q;
    while(cin>>x>>y){
    if(x>y)
        swap(x, y);
    p=x,q=y;
    while(1){
        if(x==0){
            cout<<y<<" ";
            break;
        }
        int t=x;
        x=y%x;
        y=t;
    }
    cout<<p*(q/y)<<endl;
    }
}

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

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

C++: #include<stdio.h>
int gcd(int a,int b);
int lcm(int a,int b);
int main(void){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		printf("%d %d\n",gcd(a,b),lcm(a,b));
	}
	return 0;
}

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

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

C++: #include<cstdio>
#include<iostream>
     
using namespace std;
    
int GCD(int a, int b){
  int ans;
  int big, small;
     
  big = a;
  small = b;
     
  while (big) {
    if (small > big) swap(big, small);
    big = big % small;
  }
  ans = small;

  return ans;
}
     
int LCM(int a, int b, int gcd) {
  int ans;
  
  ans = a / gcd * b;

  return ans;
}
     
     
     
     
int main(){
  int a, b;
  int gcd, lcm;

  while (cin >> a >> b) { 

    gcd = GCD(a, b);
    lcm = LCM(a, b, gcd);

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

  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,i,ii,iii,maxkouyakusuu=0,lowkoubaisuu=20000000000000;
while(i>50){
cin>>a>>b;
for(ii=0;ii<a*b;++ii){
  if(a%ii==0 && b%ii==0 && ii>maxkouyakusuu){
    maxkouyakusuu=ii;
  }
for(iii=0;iii<a*b;++iii){
  if(iii%a==0 && iii%b==0 && iii<lowkoubaisuu){
    lowkoubaisuu=iii;
  }
}
}
  cout<<maxkouyakusuu<<" "<<lowkoubaisuu<<endl;
  ++i;
}
  return 0;
}

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

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

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

C++: #include <iostream>
#include <stdio.h>

using namespace std;

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

int main()
{
	long long a, b, t;
	while (scanf("%lld%lld", &a, &b) != EOF)
	{
		if (a < b)
			t = gcd(b, a);
		else
			t = gcd(a, b);
		printf("%lld %lld\n", t, a * b / t);
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	long a, b;
	long gcd;
	while (cin >> a >> b) {
		for (int i = min(a,b); i > 0; i--){
			if (a%i == 0 && b%i == 0){
				gcd = i;
				cout << i << " ";
				goto Cs;
			}
		}
		Cs:
		cout << a /gcd * b << endl;
		for (int i = 0; i < 0; i++){}
	}
}