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 <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int a, b, r, c, d;
	int ta, tb;
	int i = 0;

	scanf("%d %d", &a,& b);
	ta = a;
	tb = b;

	while (1) {
	r = ta % tb;
	if (r == 0) break;
	ta = tb;
	tb = r;
	}
	c = tb;

	
	d = a * (b  / c);

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

	return (0);
}

C++: #include <iostream>

using namespace std;

typedef long long ll;

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

ll lcm(int a,int b){
	int table[2][100000];
	for(int i = 0; i < 2; i++)
		fill(table[i],table[i]+100000,0);
	// 1ÍÇ¿çÌà1Â¾¯Â
	table[0][1] = 1;
	table[1][1] = 1;

	int t_a=a;
	for(int i = 2; i*i <= t_a; i++){
		while(t_a % i == 0){
			table[0][i]++;
			t_a/=i;
		}
	}
	if(table[0][t_a] == 0)
		table[0][t_a]=1;

	int t_b=b;
	for(int i = 2; i*i <= t_b; i++){
		while(t_b % i == 0){
			table[1][i]++;
			t_b/=i;
		}
	}
	if(table[1][t_b] == 0)
		table[1][t_b]=1;

	ll mul = 1;
	for(int i = 2; i <= 100000; i++){
		if(table[0][i] == 0 && table[1][i] == 0)
			continue;
		else{
			int mc = max(table[0][i],table[1][i]);
			for(int j = 0; j < mc; j++)
				mul *= i;
		}
	}
	return mul;
}

int main(){

	ll a,b;
	while(1){
		cin >> a >> b;
		if(cin.eof()){
			break;
		}
		cout << gcd(a,b) << " " << lcm(a,b) << endl;
	}

	return 0;
}

C++: #include <iostream>
 
using namespace std;
 
int gcd(int a, int b)
{
    if (a % b == 0) return b;
    return gcd(b, a % b);
} 

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

C++: #include <iostream>
using namespace std;
typedef unsigned long long int lli;

lli GCD(lli a,lli b);
lli LCM(lli a,lli b);

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

lli GCD(lli a,lli b){
    if(a<b)
        swap(a,b);
    lli r = 1;
    while(r!=0){
        r = a%b;
        a = b;
        b = r;
    }
    return a;
}

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

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

int main(){
	long a, b, r, g, l, x, y;

	while(1){
		cin >> a >> b;

		if(cin.eof()){
			break;
		}

		x = a;
		y = b;
		
		if(x < y){
			swap(x, y);
		}

		while(y > 0){
			r = x % y;
			x = y;
			y = r;
		}

		g = x;
		l = (a / g) * b;

		cout << g << " ";
		cout << l << endl;
	}

	return 0;
}

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

int main(){
   int a, b, tmp, m=0, s=0, ai, bi;
   while(cin >> a >> b){
      ai=a; bi=b;
      if(a<b){
         tmp=a;
         a=b;
         b=tmp;
      }
      while(1){
         if(a%b==0){
            m=b;
            break;
         }
         else{
            a-=(a/b)*b;
            tmp=a;
            a=b;
            b=tmp;
         }
      }
      s=ai*bi/m;
      cout<< m << " " << s << endl;
   }
   return 0;
}

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

long long gcd (long long a, long long b) {
  if(a < b) {
    int foo = a;
    a = b;
    b = foo;
  }

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

int main() {
  long long a ,b;

  while (scanf("%lld %lld", &a, &b) == 2) {
    long long g = gcd(a, b);
    printf("%lld %lld\n", g, (a * b) / g);

  }

  return 0;
}

C++: #include <stdio.h>

int main(){
int a,b,g,l,i;
while (scanf("%d %d",&a,&b) !=EOF) {
g=1;
if (a<b) {i=a; a=b; b=i;}
for (i=1;i<=a;i++) {
if (a%i==0 && b%i==0) {g=i;}
}

for (i=a*b;i>=a;i--) {
if (i%a==0 && i%b==0) {l=i;}
}

printf("%d %d\n",g,l);
}
return 0;
}

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

int gcd(unsigned int a , unsigned int b){
	if (a<b) {
		a^=b;
		b^=a;
		a^=b;
	}
	return a%b ? gcd(a , a%b) : b;
}

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

int main(){
	unsigned int a , b ;
	while(cin>>a>>b){
		printf("%d %d\n" , gcd(a,b) , lcm(a , b));
	}
        return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a,b;
	while((scanf("%d%d",&a,&b))!=EOF) 
	{
		long long int c,x,y;
		x=a;
		y=b;
		c=a%b;
		while(c!=0)
		{
			a=b;
			b=c;
			c=a%b;
		}
		long long int k;
		k=(x*y)/b;
		cout<<b<<" "<<k<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){

	long long a,b,c,d;

	while(cin>>a>>b){
		c=a;
		d=b;
		while(1){
			if(c>d)c=c-d;
			cout<<c<<" "<<d<<endl;
			if(c<d)d=d-c;
			
			cout<<c<<" "<<d<<endl;
			if(c==d){
				cout<<c<<" "<<a*b/c<<endl;
				;break;}
		}}
		


return 0;
}

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

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

int main(void)
{
	unsigned int a, b, g, l;

	while( std::cin >> a >> b ){
		g = gcd( a, b );
		l = a * b / g;
		std::cout << g << std::endl;
		std::cout << l << std::endl;
	}

	return 0;
}

int gcd( int a, int b ){
	int n, i;
	unsigned int tmp[4];

	tmp[0] = std::max( a, b );
	tmp[1] = std::mix( a, b );

	for( n = 0;; n++ ){
		for( i = 1;(tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i ) >= tmp[( n + 1 ) % 3]; i++ ){
			if( tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[( n + 1 ) % 3 ];
			}
		}
		if( n > 2000000000 ){
			return -1;
		}
	}

	return -1;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
long koyaku(long a,long b);

int main(){
	long c,d,e;
	unsigned long f;
	while(cin>>c>>d){
		e=koyaku(c,d);
		f=c/e*d;
		cout<<e<<" "<<f<<endl;
	}
	return 0;
}

long koyaku(long a,long b){
	long n=max(a,b);
	long ans=1;
	for(long i=1;i<=n/2;i++){
		if(a%i==0&&b%i==0)ans=i;
	}
	if(a%n==0&&b%n==0)ans=n;
	return

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

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

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

	return 0;
}

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

using namespace std;

void solve(int a, int b) {
	int min_num = min(a,b);
	int gcj = 0;
	for (int i=min_num; i>0; i--) {
		if (a%i==0 && b%i==0) {
			gcj = i;
			break;
		}
	}
	int lcm = a*b/gcj;
	cout << gcj << " " << lcm << endl;
}

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