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 <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;

long long int gcd(long long int m,long long int n){
	if(m==0||n==0){
		return 0;
	}
	while(m!=n){
		if(m>n){
			m = m-n;
		}
		else{
			m = n-m;
		}
	}
	return m;
}
long long int lcm(long long int m,long long int n){
	if(m==0||n==0){
		return 0;		
	}
	else{
		return ((m/gcd(m,n))*n);
	}
}

int main() {
	long long int a,b,G,L;
	while(true){
		cin>>a>>b;
		if (cin.eof())break;
		G=gcd(a,b);
		L=lcm(a,b);
		cout<<G<<" "<<L<<endl;
	}
}

C++: #include <iostream>
#include <cstdio>using namespace std;
int gcd(int a, int b)

if(a < b) {
  return gcd(b, a);
}

    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<iostream>

using namespace std;

long long int a,b;

int main(void)
{
	while(cin>>a>>b){
		long long int x,y;
		x=1;
		for(int i=2;i<=a&&i<=b;){
			if(a%i==0&&b%i==0){
				x=x*i;
				a=a/i;
				b=b/i;
				i=2;
			}else{ i++; }
		}
		y=x*a*b;
		cout<<x<<" "<<y<<endl;
	}
}

C++: #include <stdio.h>

long GetGCD(long x, long y);

int main(void){
    long  n,m,gcd,lcm;
    
    while (scanf("%ld %ld", &n, &m)!=EOF){
        gcd = GetGCD(n,m);
        lcm = n * m / gcd;
        printf("%ld %ld\n", gcd, lcm);
    }
    return 0;
}

long GetGCD(long x, long y){
    return y%x ? GetGCD(y%x, x) : x;
}

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

ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else 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 <iostream>


using namespace std;

int main(){
	
	int ii = 1;
	int a;
	int b;
	while (1){
		
		cin >> a >> b;
	for (int i = 0; i <= 2000000001; i++){
		
		
		int c = ii / a * a;
		int d = ii / b * b;
		if (ii == c&&ii == d){
			cout << a * b / ii <<  " " <<ii<< endl;
			break;
		}
		else ii++;

}
	}
	
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,aa,b,bb,c,s,ss;
	while(scanf("%d %d",&a,&b)!=EOF){
		aa=a;  
		bb=b;
		if(a<b){
			c=a;
			a=b;
			b=c;
		}
		while(1)	{
			if(a%b==0)	{
				break;
			}
			else	{
				c=a%b;
				a=b;
				b=c;	
			}
		}
		s=b;
		ss=aa/b*bb;
		printf("%d %d\n",s,ss);
	}
	return 0;
}

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


int main(){
	int a , b ;
	while(cin>>a>>b){
		printf("%d %d\n" , __gcd(a,b) , (a/__gcd(a,b))*b);
	}
	return 0;
}

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

int Func_gcd(int num1, int num2){
	int surplus;

	while((surplus=num1%num2) != 0){
		num1 = num2;
		num2 = surplus;
	}
	
	return num2;
}

int main()
{
    int gcd, lcm;
	int num1, num2;
	
	while(cin>>num1>>num2){
		gcd = Func_gcd(num1, num2);
		lcm = num1 / gcd * num2;
				
		cout << gcd << " " << lcm << "\n";
	}
	
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int gcd(long long a,long long b){
    int c;
    if(a%b==0)
        return b;
    else
        c=a%b;
    if(a>c)
        return gcd(a,c);
    else
        return gcd(c,a);
}
int main()
{
    long long m,n;
    long long x,y;
    while(scanf("%I64d%I64d",&x,&y),x!=EOF,y!=EOF){
        if(x>y)
        m=gcd(x,y);
        else
        m=gcd(y,x);
    n=x*(y/m);
    printf("%I64d %I64d\n",m,n);
}
    return 0;
}

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

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

C++: #include <iostream>

using namespace std;

int GCD,LCM,a,b;

int GreatCommonDivisor(int x,int y)
{
    while(x!=y)
    {
        if(x<y)
        {
            y = y-x;
        }
        else if(x>y)
        {
            x = x-y;
        }

    }
            return x;
}
int LeastCommonMultiple(int x,int y)
{
   return (x*y)/GreatCommonDivisor(x,y);
}

int main()
{
    while(cin >> a >> b)
    {
    GCD = GreatCommonDivisor(a,b);
    LCM = LeastCommonMultiple(a,b);
    cout << GCD << " " << LCM;
    cout << endl;
    }

}

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

int gcd(int a, int b){
	if (b == 0)
		return a;

	return gcd(b, a%b);
}


int main(){

	while (true){
		int a, b;
		cin >> a >> b;

		if (cin.eof())
			break;

		int g = gcd(a, b);
		cout << g << " " << a / g*b << endl;
	}

	return 0;
}

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

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

int main(){
	while(true){
		int a,b;
		cin>a>>b;
		
		if(cin.eof())
			break;
			
		cout<<n_prime[n]<<endl;
	}
	return 0;
}

C++: #include <iostream>                                             
using namespace std;                                            
typedef long long ll;                                           
                                                                
int GCD(ll a,ll b) {                                            
  if (b==0) {                                                   
    return a;                                                   
  }                                                             
  return GCD(b,a%b);                                            
}                                                               
                                                                
int 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 <iostream>

using namespace std;

int gcd( int m, int n ){
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

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

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