Go: package main

import "fmt"

func main() {
	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
		}
		fmt.Printf("%d %d\n", y, lcm/y)
	}
}

C++: #include  <stdio.h>
int main (void)
{
int i,j,a,b,c,e,f,bai[4] = {0},yaku[4] = {0};
	
	for(i = 0;i < 2;i++){
		scanf("%d %d",&a,&b);
		if(a > b){
			c = b; e = a;
		}	
		else{
			c = a; e = b;
		}
		
		if(e % c == 0){
			yaku[i] = c;
			bai[i] = e;
		}
		else{
			for(j = 1;j < c;j++){
				if(c % j == 0){
					f = c / j;
					if(e % f == 0){
						yaku[i] = f;
						j = e;
					}	
				}
			}
			if(yaku[i] == 0){
				yaku[i] = 1;
			}
			for(j = c;j > 0;j--){
				if(j * e <= 2000000000){
					if(j * e % c == 0){
						bai[i] = j * e;
					}	
				}
			}
		}
		
	}
	
	printf("%d %d\n%d %d",yaku[0],bai[0],yaku[1],bai[1]);
	
	return(0);
}

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

int GCD( int x , int y )
{
	if( x < y ){ swap( x,y ); }

	if( x % y == 0 ){ return y ; }
	else{ GCD( y , x%=y ) ; }
}

int main()
{
	unsigned 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;

int main()
{
	long long a,b,m,n,d,e,f,i,c,k;
	while(cin>>a>>b)
	{
		if(a<b)
		{
			d=a;
			a=b;
			b=d;
		}
		e=a;
		f=b;
		c=a%b;
		 while (c!=0)   
         {
		 	a=b;
		 	b=c;
		 	c=a%b;
		  }
		n=b;
		k=(e*f)/n;
		m=k;
		cout<<n<<" "<<m;
		cout<<endl;
	}
	return 0;
 }

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

long long gcd(int n,int m){
	if(m==0)return n;
	gcd(m,n%m);
}
int main(){
	long long  n,m;
	while(cin>>n>>m){
		cout<<gcd(n,m)<<" "<<n*m/gcd(n,m)<<endl;
	}
	return 0;
}

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

int main(){
    unsigned int a,b,c;
    int g,l,p;
    while(1){
        cin>>a>>b;
        p=a*b;
        while(b!=0){
            c=b;
            b=a%b;
            a=c;
        }
        g=a;
        l=p/g;
        cout<<g<<" "<<l<<endl;
    }
    return(0);
}

C++: #include<iostream>
int e(int a,int b){return(a%=b)?e(b,a):b;}int main(){for(int a,b,c,s;s=!(std::cin>>a>>b).eof();s&&printf("%d %d\n",c,a/c*b))c=e(a,b);}

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

template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class itr, class func> void array_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr, class func> void nint_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += string(out(*i)) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)

int main(){
    long a, b;
    while(cin >> a >> b){
        cout << gcd(a, b) << " " << a / gcd(a, b) * b << 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){
    return b==0 ? a : gcd(b,a%b);
}

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

int main (int argc, char const* argv[])
{
    int a,b;
    while(cin >> a >> b){
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
    return 0;
}

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

int LCM(int n, int m);

int main()
{
  int a, b, lcm;
  long long gcd;
  while (cin >> a >> b){
    if (a > b){
      int c = a;
      a = b;
      b = c;
    }
    lcm = LCM(a, b);
    gcd = a * b / lcm;

    cout << lcm << " " << gcd << endl;
  }
}

int LCM(int n, int m)
{
  if (n == 0){
    return (m);
  }
  m = m % n;
  return (LCM(m, n));
}

C++: #include <cmath>
#include <cstdlib>
#include <cstdio>

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

int main() {
  long a, b;
  long x, y;
  long gcd, lcm;

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

    if( x < y ) std::swap(x, y);

    while( y != 0 ) {
      x %= y;
      std::swap(x, y);
    }

    gcd = x;
    lcm = (a / gcd) * b;

    std::cout << gcd << " " << lcm << std::endl;
  }  

  return 0;
}

C++: #include <iostream>

using namespace std;

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

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

	return 0;
}

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

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

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

typedef long long ll;

ll gcd(ll a, ll b){
    return (a%b ? gcd(b,a%b) : b);
}

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

C++: #include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll GCD(ll a,ll b){
	if(b==0)return a;
	return GCD(b,a%b);
}
int main(){
	ll a,b;
	while(cin>>a>>b){
		ll gcd=GCD(a,b);
		cout<<gcd<<" "<<a*b/gcd<<endl;
	}
	return 0;
}

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

int main() {
	long a,b,G;
	while (cin>>a>>b){
	long c = 1;
	for (c = 1;c <= b ;c= c+1){
		if(a%c == 0 , b%c == 0){
			G = c;
		}
	}cout<<G<<" "<<a*b/G<<endl;
	}
}

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

using namespace std;

int main(void){

	int a,b,r;
	int tmp;
	double g,l;
	double tmpa,tmpb;

	while(cin>>a>>b){
		tmpa=a;
		tmpb=b;
		r=1;
		while(r){
			if(a<b){
				tmp=a;
				a=b;
				b=tmp;
			} 
			r=a%b; a=b; b=r;	
		}
		g=a;
		l=tmpa*tmpb/g;
		//cout.unsetf(ios::scientific);
		cout << fixed << setprecision(0) << g << ' ' << l << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <math.h>
#define eps 1e-9
using namespace std;
long long int gcd(long long int a,long long int b)
{
    return b?gcd(b,a%b):a;
}
int main()
{
    long long int x,y;
    while(cin >> x >> y)
    {
        cout << gcd(x,y) << " " << x*y/gcd(x,y) << endl;
    }
    return 0;
}