Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [100]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == 0 {
			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++: #include <bits/stdc++.h>
using namespace std;
// #define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int inf = 1e9;

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

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

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

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

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

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

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

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

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

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


signed main(){
  int a,b;
  while(cin>>a>>b){
    cout<<gcd(a,b)<<' '<<lcm(a,b)<<endl;
  }
  return 0;
}

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

C++: #include <iostream>
using namespace std;
 
int get_gcd(int n, int m) {
  while(m) {
    swap(m, n);
    m %= n;
  }
  return n;
}
 
int main() {
  int a, b;
  while (cin >> a >> b) {
    if (a > b) swap(a, b); 
    int gcd = get_gcd(a, b);
    cout << gcd << " " << a / gcd * b << endl;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>

#define sf scanf
#define pf printf

using namespace std;

int GCD(int a,int b)
{
    if(b == 0) return a;
    return GCD(b,a%b);
}
int main()
{
    int a,b;
    while(~sf("%d%d",&a,&b))
    {
        int gcd = GCD(a,b);
        int lcm = a / gcd * b;
        pf("%d %d\n",gcd,lcm);
    }
    return 0;
}

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

int gcd(int a,int b)
{
    int l,s,r;
    if (a<b)
    {
	l=b;
	s=a;
    } else {
	l=a;
	s=b;
    }
    while(true)
    {
	r=l%s;
	if (r == 0) break;
	l=s;
	s=r;
    }
    return s;
}

int main()
{
    int a,b;
    vector<int> r1,r2;
    while (scanf("%d %d",&a,&b) != EOF)
    {
	r1.push_back(gcd(a,b));
	r2.push_back(a/r1[r1.size()-1]*b);
    }
    for (int i=0; i<r1.size(); i++)
    {
	cout << r1[i] << " " << r2[i] << endl;
    }
}

C++: #include <assert.h>
#include <ctype.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

#include <algorithm>
#include <complex>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define SZ(a) (int)(a).size()
#define FOR(i,a,b) for (int i=(a); i<=(b); ++i)
#define REP(i,n) for (int i=0; i<(n); ++i)
#define ALL(c) c.begin(), c.end()
#define CLR(c,n) memset(c, n, sizeof(c))
#define TR(it, c) for(typeof(c.begin()) it = c.begin();it != c.end(); ++it)
#define CONTAIN(it, c) (c.find(it) != c.end())
typedef vector<int> VI;
typedef pair<int, int> PII;
template <class T> void checkmin(T &a, T b) { if (b<a) a=b; }
template <class T> void checkmax(T &a, T b) { if (b>a) a=b; }
const int INF=0x3F3F3F3F;

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

int main(int argc, char *argv[]) {
  int a, b;
  while (scanf("%d %d", &a, &b) == 2) {
    int g = gcd(a, b);
    printf("%d %d\n", g, a / g * b);
  }
}

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

int main(){ 
    unsigned long long int a,b,n,m;

    while(cin >> a >> b){
        if(a >= b){
            m = a;  
            n = b;  
        }       
        else{   
            n = a;  
            m = b;  
        }       

        while(n != 0){
            unsigned long int i = n;
            n = m % n;
            m = i;  
        }       
        n = a*b/m;

        cout << m << " " << n << endl;
    }
    return 0;

}

C++: #include <iostream>
#include <cmath>
using namespace std;
long gcd(long a, long b){
  if(b == 0){
    return a;
  }
  return gcd(b, a % b);
}
int main(){
  long a, b;
  while(cin >> a >> b){
    cout << gcd(a, b) << " ";
    cout << (a * b) / gcd(a, b) << endl;
  }
  return 0;
}

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

long long gcd(long long m, long long n);
long long lcm(long long m, long long n, long long g);

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    long long a, b;
    long long g, l;
    while (std::cin >> a >> b) {
        g = gcd(a, b);
        l = lcm(a, b, g);
        std::cout << g << " " << l << std::endl;
    }
}

long long gcd(long long m, long long n)
{
    long long t;
    if (m < n) {
        t = m;
        m = n;
        n = t;
    }
    if (n == 0) return m;
    return gcd(n, m % n);
}

long long lcm(long long m, long long n, long long g)
{
    return m * n / g;
}

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

typedef long long ll;

int EuclidAlgo(int a,int b);

int main()
{
        ll a,b,ans1,ans2;

        while(cin >> a >> b){

                if(a < b) swap(a,b);

                ans1 = EuclidAlgo(a,b);
                ans2 = (a*b)/ans1;

                cout << ans1 << ' ' << ans2 << "\n";



        }

        return 0;

}

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

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 <stdio.h>

using namespace std;

int calcMax(int a,int b){
	int tmp;
	if(a > b){
		while(b != 0){
			tmp = b;
			b = a%b;
			a = tmp;
		}
		return a;
	}else{
		while(a != 0){
			tmp = a;
			a = b%a;
			b = tmp;
		}
		return b;
	}
}



int calcMin(int a,int b){
	int max_common = calcMax(a,b);
	return (a/max_common)*b;
}

int main(){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		printf("%d %d\n",calcMax(a,b),calcMin(a,b));
	}

    return 0;
}