Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

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

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


unsigned long long int GCM(unsigned long long int a,unsigned long long int b){
	while(a!=b){
		a>b? a-=b:b-=a;
	}
	return a;
}

int main()
{
	ifstream ifs("Text.txt");
	unsigned long long int a,b,L,G;
	
	ifs>>a;
	do{
	ifs>>b;
	if(a!=0&&b!=0){
	G=GCM(a,b);
	L=a*b/G;
	cout<<G<<" "<<L<<endl;
	}
	}while(ifs>>a);
}

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

int main()
{
	int a, b;

	while(cin >> a >> b)
	{
		int l;
	    int g = 1;

		for (int i = 2; a > i && b > i; i++)
		{
			for (int j = 0; a % i == 0 && b % i == 0; j++)
			{
				a = a / i;
				b = b / i;
				g *= i;
			}
		}

		l = g * a * b;
		cout << g << " " << l << endl;
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

int gcd(int a,int b){
  
  return b>0 ? gcd(b,a%b):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<iostream>
#include<utility>

int main(){
  unsigned int a,b,tmp,GCD;
  while ( std::cin >> a >> b){
    if( b > a )std::swap( a , b );
    unsigned long int LCM = a;
    GCD = b;
    while(a % GCD != 0){
      tmp = a % GCD;
      a = GCD;
      GCD = tmp;
    }
    LCM = ( LCM / GCD ) * b;
    std::cout << GCD << " " << LCM << std::endl;
  }
  return 0;
}

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

int main(){
	long long a,b;
	while(cin >> a >> b){
		vector<long long> num;
		long long k = 0;
		long long max = 1;
		for(long long i = 2; i < a/2; i++){
			if(a % i == 0){
				num.push_back(i);
				k++;
			}
		}
		for(long long i = 0; i < k; i++){
			if(b % num[i] == 0){
				max = num[i];
			}
		}
		long long min = (a * b) / max;
		cout << max << " " << min << endl;
	}
	return 0;
}

C++: #include<stdio.h>
int gcd(unsigned int M,unsigned int N)
{
    if(M%N==0)return N;
    return gcd(N,M%N);
}
int main()
{
    unsigned int M,N,t;
    while(scanf("%u%u",&M,&N)!=EOF)
    {
        t=gcd(M,N);
        printf("%u %u\n",t,M*N/t);
    }
    return 0;
}

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

typedef unsigned long long L;
int main(){
	for(L a,b,c,d,e; cin>>a>>b;){
		for(c=a,d=b;;){
			e = c % d;
			c = d;
			d = e;
			if(!e)break;
		}
		cout<<c<<" "<<a*b/c<<endl;
	}
}

C++: #include<iostream>

using namespace std;

int gcd(int,int);
int lcm(int,int);

main(){

  int a, b;

  
  while(cin >> a >> b){

    cout << gcd(a,b) << " "<<lcm(a,b) << endl;

    

  }

}


int gcd( int m, int n )
{
	// [NbhÌû@
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd


// Å¬ö{iLeast Common MultiplejðÔ·B// øÉOª éêÍOðÔ·B

int lcm( int m, int n )
{	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    long long a,b,i,f;
    cin>>a>>b;
    for(i=20000000;i>0;i--){
        if(a>=2000000000||b>=2000000000||a<1||b<1){
            break;
        }
        if(a%i==0&&b%i==0){
            f=a*b/i;
            cout<<i<<" "<<f<<endl;
                break;
        }
    }
    
    return 0;
}

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

using namespace std;

int find_GCD(int a, int b){
  int max = 0;
  for(int i=1;i<min(a, b);i++){
    if(a%i==0 && b%i==0){
      max = i;
    }
  }
  return max;
}

int find_LCM(int a, int b){
  int LCM;
  for(int i = max(a, b)+1;;i++){
    if(i%a==0 && i%b==0){
      LCM = i;
      break;
    }
  }

  return LCM;
}

int main(){
  int a, b;
  while(cin >> a >> b){
    //    cout << a << " " << b <<endl;
    //    int GCD = find_GCD(a, b);
    //    cout << GCD << endl;
    //    cout << find_GCD(a, b) << endl;
        cout << find_GCD(a, b) << " " << find_LCM(a, b) << endl;
  }

}

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

using namespace std; 

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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


int main(){
  int a,b;
  while(1){
    cin >> a >> b;
    if(cin.eof())
      break;
    int g=gcd(a,b);
    //printf("%d %d\n",g,a/g*b);
    cout << g << ' ' << a/g*b << 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 = max(gcj, i);
	}
	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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){

  int a,b;
  int yaku,bai;
  while(cin >> a >> b){
    for(yaku=a;1<yaku;yaku--)
      if(a%yaku==0 && b%yaku==0)
	break;

    for(bai=2;bai<=a;bai++)
      if((bai*b)%a==0){
	bai *= b;
	break;
      }
    cout << yaku << ' ' << bai << endl;
  }
  return 0;
}

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

using namespace std;

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

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