Go: package main

import (
	"fmt"
)

func main() {
	var a, b int
	for {
		i, _ := fmt.Scan(&a, &b)
		if i == 0 {
			break
		}

		gcd := getGCD(a, b)
		fmt.Println(gcd, getLCM(a, b, gcd))
	}
}

func getGCD(a, b int) int {
	if b == 0 {
		return a
	}
	return getGCD(b, a%b)
}

func getLCM(a, b, gcd int) int {
	return a * b / gcd
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

int lcm(int a, int b) {
	if(!a&b) return 0;
	else 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>
int gcd(int a , int b){
    return (b == 0)? a : gcd(b , a % b);
}
int main(){
    int a , b;
    while(std::cin >> a >> b){
        int x = gcd(a , b);
        std::cout << x << " " << x * (int)(a / x) * (int)(b / x) << "\n";
    }
}

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

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

int gcd(int u, int v) {
  int r;
  while (0 != v) {
    r = u % v; u = v; v = r; /* swap */
  }
  return u;
}

int main(){
	int a,b,x;
	cin>>a>>b;
	cout<<gcd(a,b)<<" ";
	x=a*b;
	if(a<b){
		int tmp = a;
		a = b;
		b = tmp;
	}
	cout<<x/gcd(a,b)<<endl;

    return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
	double a, b;
		while(cin >> a >> b){
		double c = a, d = b;
		while(c != d){
			if(c > d) c = c - d;
			else d = d - c;
		}
		d = a * b / c;
		printf("%.0lf %.0lf\n", c, d);
	}
	return 0;
}

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

int gcd(int a, int b) {
    
  	int p,q,r;
  	if(a>b){p=b;b=a;a=p;}
	while(r!=0){
	q=b/a;
	r=b%a;
	b=a;
	a=r;
	}
	return b;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int GCDserch(long long int a,long long int b)
{
    if(a%b==0)return b;
    return GCDserch(b,a%b);
}
int main()
{
    long long int a,b,ch,GCD,LCM;
    while(cin>>a>>b){
            if(b>a){
                ch=a;
                a=b;
                b=ch;
            }
        GCD=GCDserch(a,b);
        LCM=a*b/GCD;
        cout<<GCD<<" "<<LCM<<endl;
    }
}

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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	unsigned long long a,b,c,d,e,f,maxx=0,data,minn=0,o;
	while (scanf("%llu %llu",&a,&b)!=EOF){
		if (a>b){
			d=a%b;
			if (d==0) maxx=b;
			else{
				maxx=b%d;
				if (maxx==0)maxx=d;
			}
		}
		else {
			d=b%a;
			if (d==0) maxx=b;
			else{
				maxx=a%d;
				if (maxx==0)maxx=a;
			}
		}
		cout<<maxx<<" "<<a*b/maxx<<endl;
		maxx=0;
		minn=0;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>

using namespace std;

long long gcm(long long n, long long m) {
	if (n == 0) return m;
	else return gcm(m%n, n);
}



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





}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<functional>
#include<queue>
#include<math.h>
#define INF 999999

using namespace std;

typedef long long ll;

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

int main()
{
	ll a, b;
	while (cin >> a >> b) {

		ll c = gcd(a, b);
		ll d = a*b / c;

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

	return 0;
}

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

typedef long long ll;

ll gcd(ll num1, ll num2){ return num2 == 0?num1:gcd(num2, num1 % num2); }
ll lcm(ll num1, ll num2){ return num1 * num2 / gcd(num1, num2); }

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

C++: #include<cstdio>
int g(int a,int b){return b?g(b,a%b):a;}
main(){int a,b,t;while(~scanf("%d%d",&a,&b))printf("%d %d\n",t=g(a,b),a/t*b);}

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

int main(){
	long a,b,tmp,i;
	
	while(cin>>a>>b){
		if(a>=b) i=a;
		else i=b;
		
		for(;0!=(a%i)+(b%i);i--);
		cout<<i<<" "<<a*b/i<<endl;
	}
	return 0;
}

C++: #include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>

typedef long long ll;

using namespace std;

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

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

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

    return 0;
}

C++: #include <cstdio>

using namespace std;

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

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

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

using namespace std;

long long kpk(long long n, long long m){
	long long a,b;
	a=n;
	b=m;
	while(a!=b&&b!=a){
		while(a<b){
			a+=n;
		}
		while(b<a){
			b+=m;
		}
	}
	return b;
}

long long fpb(long long n, long long m){	
	long long r;
	if (n<m){
		swap(n,m);
	}
	r=n%m;
	while(r>0){
		n=m;
		m=r;
		r=n%m;
	}
	return m;
	}
	
int main(){
	long long a,b;
	while(cin>>a>>b){
		cout<<fpb(a,b)<<' '<<kpk(a,b)<<endl;
	}
}

C++: 
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#define pi 3.14159265358979323846264338
using namespace std;

int main() {
	int n, m;
	while (cin >> n >> m) {
		long long a = n, b = m,keep;
		while (a != b) {
			keep = min(a, b);
			b = max(a, b) - min(a, b);
			a = keep;
		}
		cout << a << " " << n/a*m << endl;
	}
	return 0;
}