Go: package main

import "fmt"

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

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d\n", G, L)
	}
}

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

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

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

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

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

C++: #include<iostream>
using namespace std;
int main()
{
	int a, b;
	double A, B;
	cin >> a >> b;
	double c = a;
	double d = b;
	if (a <= b)
	{
		while (a != 0)
		{
			int r = b%a;
			b = a;
			a = r;
		}
		A = b;
	}
	if (a > b)
	{
		while (b != 0)
		{
			int r = a%b;
			a = b;
			b = r;
		}
		A = a;
	}
	B = c*d / A;
	cout << A<<" "<<B<<endl;
	return 0;
}

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

int GCD(int a, int b)
{
	int max = 0, c = (a < b) ? b : a;
	for (int i = 1; i <= c; ++i) {
		if (a%i == 0 && b%i == 0)max = i;
	}
	return max;
}

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

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

C++: #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <fstream>
#include <stdint.h>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;

constexpr int INF       = 1000000000;/* 1e+9a */
constexpr int MODULO    = 1000000007;

#define REP(i,f,n) for(int i=(f); i < (n); ++i)
#define PER(i,f,n) for(int i=(n-1); i >= f; --i)


//----------------------------------
//----------------------------------

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

signed main()
{
    ios::sync_with_stdio(false);
	int64_t a, b;
	while(cin >> a)
	{
		cin >> b;
		int64_t gc = gcd(max(a,b),min(a,b));
		cout << gc << ' ' << a * b / gc << endl;
	}

}