Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	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
		}
		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 <iostream>
using namespace std;

int saidai(long  a,long  b){
	while(b != a){
		if(a > b){
			a -= b;
		}else {
			b -= a;
		}
	}
	return a;
}


int	saisyou( long  a,long b , long c){
	return a/c*b;
}

int main(){
	long  a,b;
	cin>>a;
	cin>>b;
	long ans = saidai(a,b);
	cout<<ans<<" "<<saisyou(a,b,ans);;
	return 0;

}

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

using namespace std;

int getGcd(int x, int y){
	int r;
	if(x==0 || y==0){
		return 0;
	}
	while( (r=x%y) != 0 ){
		x=y;
		y=r;
	}
	return y;
}

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

C++: #include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main()
{
    unsigned long x, y;
    
    while (cin >> x >> y)
    {
        unsigned long a = x, b = y;
        while (true)
        {
            unsigned long tmp = b;
            b = a % b;
            a = tmp;
            if (b == 0)
            {
                break;
            }
        }
        cout << a << " " << x / a * y << endl;
    }
    
    return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;

int gcd(int a,int b){
	while(1){
		if(a<b)swap(a,b);
		if(!b)break;
		a%=b;
	}
	return a;
}

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

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

C++: #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <ctime>
#include <iterator>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;


long long pgcd(long long a,long long b)
{
    return a==0?b:pgcd(b%a,a);
}

long long ppcm(long long a,long long b)
{
    return a*b/pgcd(a,b);
}

int main()
{
    long long a,b;
    while(cin>>a>>b)
    {
        cout<<pgcd(a,b)<<" "<<ppcm(a,b)<<endl;
    }
}

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

using namespace std;

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

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

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

int saidai(long long int a,long long int b){
	while(b){
		int m=a%b;
		a=b;
		b=m;
	}
	
	return a;
}


int	saisyou( long long int a,long long int b ){
	return (a*b)/saidai(a,b);
}

int main(){
	long long int a,b;
	cin>>a;cin>>b;
	
	cout<<saidai(a,b)<<" "<<saisyou(a,b);;
	return 0;

}

C++: #include<iostream>

int gcd(int a, int b){
    while((int remainder = a % b) != 0) {
        a = b;
        b = remainder;
    }
    return b;
}

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

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	long long a,b,min,x,y;
	while(cin>>a>>b){
        if(a>b){
            x=a;
            y=b;
        }else{
            x=b;
            y=a;
        }
			while(x%y!=0){
				min=x;
				x=y;
				y=min%y;
				}
			
		cout<<y<<" "<<(a*b/y)<<endl;
	}
	return 0;
}

C++: #include<iostream>

void swap(int *x, int*y)
{
	int temp=0;

	temp = *x;

	*x = *y;

	*y = temp;
}

int main()
{
	int a=0, b=0, c=0, d=0;

	while(std::cin >> a >> b)
	{	
		c=a;

		d=b;//最小公倍数の計算のため保存

		if(a<b)
		{
			swap(&a,&b);
		}

		while(a%b!=0)
		{
			a = a%b;

			swap(&a,&b);

		}

		std::cout << b << ' ' << c/b*d << '\n';
	}
}

C++: #include <iostream>

using namespace std;

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

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

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

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


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

int main() {
    //freopen("0005.txt", "r", stdin);
    int a, b;
    while (cin >> a >> b) {
        int g = gcd(a, b);
        cout << g << " " << (a / g * b) << "\n";
    }
}

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

int main(){
int i = 0;int a = 0;int b = 0;int aa = 0;int bb = 0;
while(!cin.eof()){
cin >> a >> b;
if(a >= b){
aa = b;bb = a;
}
else{
aa = a;bb = b;
}
while(aa != 0){
int c = 0;
bb = bb % aa;
c = aa;
aa = bb;
bb = c;
}
int P = a * b;
cout << bb << " " << P / bb << endl;

}
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<iomanip>
using namespace std;
#define L long long int
L gcd(L a,L b){
	if(a<b){
		return gcd(b,a);
	}else if(a>b){
		return gcd(a-b,b);
	}else{
		return a;
	}
}

int main(){
L a,b,g;
while(cin>>a>>b){
	g=gcd(a,b);
	cout<<g<<" "<<a*b/g<<endl;
}

return 0;
}

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

using namespace std;

int calc_gcj(int a, int b) {
	int A=0, B=0;
	if (a == max(a,b)) {
		A = a;
		B = b;
	} else {
		A = b;
		B = a;
	}
	if (A == B) return A;
	else return calc_gcj(B,A-B);
	return -1;
}

void solve(int a, int b) {
	int gcj = calc_gcj(a,b);
	int lcm = a*b/gcj;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

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

int main(void){
  int i,j,k,l,m=1,a,b,c[10],d[10],e;
  scanf("%d %d",&a,&b);
  if(a<b){
    k = b;
    b = a;
    a = k;
  }
  j = k = 0;
  for(i=2;i<a;i++){
    if(!(a%i)){
      c[j] = i;
      j += 1;
    }
  }
  for(i=2;i<b;i++){
    if(!(b%i)){
      d[k] = i;
      k += 1;
    }
  }

  for(i=j-1;i+1;i--){
    for(l=k-1;l+1;l--){
       if(c[i] == d[l]){
	printf("%d ",c[i]);
	m = 0;
	e = c[i];
	break;
      }
    }
    if(!m)
      break;
  }
  printf("%d",a*b/e);
  return 0;
}

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

#define rep(i,n) for(int i=0; i<n; i++)
#define swap(a,b) tmp=a, a=b, b=tmp
int main(){
	long long int a, b, ai, bi, tmp;
	while(cin >>ai>>bi){
		a=ai, b=bi;
		if(a<b) swap(a,b);
		while(true){
			if(a%b==0) break;
			a%=b;
			swap(a,b);
		}
		cout << b << " " << ai*bi/b << endl;
	}
		

    return 0;
}

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

void AOJ0005()
{
	long a, b;
	while (cin >> a)
	{
		cin >> b;
		long c = max(a,b);
		long d = min(a,b);
		while (c != d)
		{
			long e = c - d;
			c = max(d, e);
			d = min(d, e);
		}
		long f = a/c * b;
		cout << c << " " << f <<endl;
	}
}

int main()
{
	AOJ0005();
	return 0;
}

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

int main() {
	int a, b, c, d;
	while(cin >> a >> b) {
		c = a;
		d = b;
		while (1) {
			if(a == 0) {
			cout << 0 << " " << 0 << endl;
			break;
			}
			if ((max(a, b) % min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a  = a%b;
			}else b = b%a;
		}
		if(a != 0) { 
		cout << " " << c * d / min(a,b) << endl;
		}
	}

	return 0;
}