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 <iostream>
using namespace std;

int gcd(int x,int y){
  if(x%y==0) return y;
  else{
    int z=x%y;
    return gcd(y,z);
  }
}

int main()
{
  int a,b;
  int g;
  long int l;
  while(cin >> a >> b){
  
    if(a>b) g=gcd(a,b);
    else if(a<b) g=gcd(b,a);
    else g=a;

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

  return 0;
}

C++: #include <cstdio>

using namespace std;

#define min( x, y ) ( ( x < y ) ? x : y )

int main()
{
	char buf[1024];
	int a, b;

	while ( fgets( buf, sizeof( buf ) - 1, stdin ) != NULL && buf[0] != '\n' )
	{
		sscanf( buf, "%d %d", &a, &b );

		for ( int i = min( a, b ); 1 < i; i-- )
		{
			if ( !( a % i ) && !( b % i ) )
			{
				printf("%d ", i );
				break;
			}
		}

		for ( int i = 1; i * a <= 2000000000; i++ )
		{
			if ( !( i * a % b ) )
			{
				printf("%ld\n", i * a );
				break;
			}
		}
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

// プロトタイプ宣言
int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i<j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	
	if(j == 0){
		return i;
	}else{
		return gcd(j, i%j);
	}
	
}

C++: #include<iostream>
#include<string>
#include <algorithm>
#include<iomanip>
#include<cmath>
using std::cin; using std::string;
using std::cout; using std::endl;
using std::sort;
#define rep(X,Y) for(int (X)=0;(X)<(Y);++(X))
#define rept(X,Y,Z) for(int (X)=(Y);(X)<(Z);++(X))
#define repr(X,Y) for(int (X)=(Y);(X)>=0;--(X))
const double pi=3.141592653589793283462;
int main(){
    int a,b;
	 int gcd;
	 int lcm=0;
	while(cin>>a>>b){
	    for(int i=1;i<=b;i++){
		    if(a%i==0 && b%i==0)
			    gcd=i;
	        }
	    lcm=(a/gcd)*(b/gcd)*gcd;
	    cout<<gcd<<" "<<lcm<<endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#define int long long
using namespace std;
 
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
    }
signed main(){
 int a,b;
 while(cin>>a>>b){
     int c=gcd(a,b);
     printf("%lld %lld\n",c,a*b/c);
     }
}

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

using namespace std;

template<typename T> T gcd(T a, T b) {
  return __gcd(a, b);
}

template<typename T> T lcm(T a, T 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>
using namespace std;
int main() {
    int a;
    int b;
    while(cin>>a>>b){
        int c=a*b;
    while(a%b!=0&&b%a!=0){
        if(a>b){
            a=a%b;
        }
        else if(b>a){
            b=b%a;
        }
    }
    if(a>b) cout<<b<<" "<<c/b;
        else cout<<a<<" "<<c/a;
        
    }
    return 0;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b),swap(ta,tb);
	while(1){
	
		int tmp=b;
		b=a%b;
		a=tmp;
		cout<<a<<b<<endl;
		if(b==0)break;
	}
	cout<<a<<" "<<ta*tb/a<<endl;
	}
	return 0;
}

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

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

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>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

int main()
{
//	cut here before submit 
//	freopen ("testcase.GCD_and_LCM", "r", stdin );
	string str = "";
	while (getline (cin, str ) ){
		stringstream ss (str );
		int a, b;
		ss >> a >> b;
		int g = gcd (a, b );
		int l = a/g;
		l *= b;
		printf ("%d %d\n", g, l );
	} // end loop
		
	return 0;
}

C++: //↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑

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) {
	long long  g = gcd(a, b);
	return a / g * b;
}

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

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

int gcd(int a,int b){
    int c;
    if(a<b){
        a+=b;
        b=a-b;
        a-=b;
    }
    while(b!=0){
        c=a%b;
        a=b;
        b=c;
    }
    return a;
}
 
int main(){
    int data0,data1;
    int answer;
    while(cin>>data0>>data1){
        answer=gcd(data0,data1);
        cout<<answer<<" "<<data0/answer*data1<<endl;
    }
}

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

int gcd(int a, int b)
{
    int i;
    if (b > a){
        int j = a;
        a = b;
        b = j;
    }
	for (i = a; i*i >= a; i--){
		if (a % i == 0)
			if( b % i == 0)
				return i;
	}
}


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;
int main(){
  int sn = 0;
  int bn = 0;
  int p,mem,d1,d2,f,lcm,gcd;
  int count = 0;
  while(cin>>sn>>bn){
  if(sn>bn){
    mem = bn;
    bn = sn;
    sn = mem;
  }
  p = bn * sn;
  for(int i=bn;i<=p;i++){
    if(i%sn==0&&i%bn==0) lcm = i;
    break;
  }
  for(int i=sn;i>=1;i--){
    if(sn%i==0&&bn%i==0) gcd = i;
    break;
  }
  /*d1 = lcm;
  while(d1==0){
    d1 = d1 / 10;
    count++;
  } 
  d1 = count;
  count = 0;
  d2 = gcd;
  while(d2==0){
    d2 = d2 /10;
    count++;
  }
  d2 = count;
  f = d1 - 2;*/
  cout << gcd << ' '<< lcm <<endl;
  /*cout << "最大公倍数は　"　<< gcd << ' ' <<　"です。" << endl;
  cout << "最大公約数は"　<< lcm;  
  for(i=0;i<f;i++) cout << ' ';
  cout << "です。"　<< endl;*/
  }
  return 0;
}

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

long long gcd(long long a, long long b){
    long long x,r;
    if(a < b){
      x = a;
      a = b;
      b = x;
      }
    for(x = 0; b != 0; x++){
      r = a%b;
      a = b;
      b = r;
    }
    return a;
}
int main(void){
    long long a, b;

    while(cin >> a >> b){
    long long lcm = a*b/gcd(a,b);
    cout << gcd(a,b) << " " << lcm << endl;
}

    return 0;
}