Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

C++: #include <iostream>

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

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

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

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(i % j ==0){
		return j;
	}
	
	i %= j;
	int tmp;
	tmp = i;
	i = j;
	j = tmp;
	return gcd(i, j);
}

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

int GCD(int x,int y) {
    if (x<y) {
        swap(x,y);
    }
    if (y==0) {
        return x;
    }
    return GCD(y,x%y);
}
int LCM(int x,int y) {
    return x*y/GCD(x,y);
}
int main() {
    int a, b;
    while (cin >> a >> b) {
        printf("%d %d\n",GCD(a,b),LCM(a,b));
    }
    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 <cstdio>
using namespace std;

int gcb(int x, int y)
{
  if(y == 0)return x;
  return gcb(y, x % y);
}

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

C++: #include<iostream>
#include<sstream>
#include<cstdio>
#include<fstream>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
using namespace std;

#define ull unsigned long long

ull mcd(ull a,ull b){
	ull r = a%b;
	ull q = b;
	while(r>0){
		ull c = r;
		r = q%r;
		q = c;
	}
	return q;
}

int main(){
	ull n,m;
	while(cin>>n>>m){
		ull w = mcd(max(n,m),min(n,m));
		cout<<w<<" "<<(n*m)/w<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int gcd(int a; int b){
	if(b>0){
		return gcd(b, a%b);
	}
	else{
		return 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<algorithm>
using namespace std;

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = temp_b;
		cout << gcd << " ";

		lcm = a * b / gcd;
		cout << lcm << endl;

	}

	//getchar();

	return 0;
}

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

int SKB(double x, double y, double w){
	double n = (x*y)/w;
	return (int)n;
}

int YUK(int x, int y){
	int c;
		c = x%y;
		if(c == 0){
			return y;
		}else{
			return YUK(y,c);
		}
}

int main(){
	int a, b;

	while( cin >> a >> b ){
		int d;
		if(a >= b){
			d = YUK(a,b);
			cout << d << '\n' << SKB(a,b,d);

		}else{
			d = YUK(b,a);
			cout << d << '\n' << SKB(a,b,d);
		}
		cout << '\n';
	}

	return 0;
}

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

using namespace std;
#define ull unsigned long long

ull gcd(ull a, ull b) {
    if (a == b) return a;
    if (a > b) {
        return gcd(a - b, b);
    } else {
        return gcd(a, b - a);
    }
}

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

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

C++: #include<iostream>
using namespace std;
typedef long long llong;
llong gcd( llong x, llong y ){
  //int r;
  llong r;
  
  if ( x < y ) swap( x, y );

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

  return x;
}

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

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

using namespace std;

int main()
{
	long long a,b;
	long long GCD=0,LCM=0;
	long long tmp=0;

	
	while (cin >> a >> b)
	{
		tmp = a%b;
		while (tmp!=0) {
			a = b;
			b = tmp;
			tmp = a%b;
		}
		GCD = b;

		LCM = a*b / GCD;

		cout << GCD <<" "<<LCM<<endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int a,b;

int gcd(int x,int y);
int lcm(int x,int y);

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

int gcd(int x,int y){
	if(x==0&&y==0)return 0;
	while(x!=y){
		if(x>y)x=x-y;
		else y=y-x;
	}
	return x;
} 

int lcm(int x,int y){
	if(x==0&&y==0)return 0;
	return (x/gcd(x,y))*y;
}

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

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

    int max = max(a,b);
    int min = min(a,b);

    int gcd = 0, lcm = 0;

    for(int i = 0; i < min; i++){
        if(max % i == 0) 
          gcd = i;
    }
    
    int j = 1;

    while(1){
      if((max * j) % min == 0){ 
        lcm = max * j; break;
      }
      else{ 
        i++;
      }
    }
    
    cout << gcd << " " << lcm << endl;
  }
}

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

using namespace std;

int a,b;

void search(int t)
{
	int r;
	
	if(r==0)
		return;
	
	if(t==1)
	{
		r=a%b;
		a=r;
		search(t=0);
	}
	else
	{
		r=b%a;
		b=r;
		search(t=1);
	}
	
}
int main()
{
	int a2,b2;
	
	for(;cin >> a;)
	{
		cin >> b;
		a2=a;
		b2=b;
		
		a=max(a2,b2);
		b=min(a2,b2);
		
		search(1);
		
		a=max(a,b);
		
		cout << a << " " << a2*(b2/a) << endl;
	}
}

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

int main(){
	int a,b;
	int gcd,lcm,hoge;
	while(cin >> a >> b){
		if (a > b) {
			hoge = a;
			a = b;
			b = hoge;
		}
		for (int i=1;i < a;i++){
			if (a%i==0 && b%i==0){
				gcd = i;
			}
		}
		for (int j=a;1;j++){
			if (j%a==0 && j%b==0){
				lcm = j;
				break;
			}
		}
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: #include<cstdio>

int gcd(int a, int b){
    if(a == b)
        return a;
    else if(a > b)
        a -= b;
    else if(a < b)
        b -= a;
    return gcd(a, b);
}

int lcm(int a, int b){

    return (a / gcd(a, b)) * (b / gcd(a, b)) * gcd(a, b);
}

int main(){
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n%d\n128", gcd(a, b), lcm(a, b));
    return 0;
}

C++: #include <iostream>
#include <stack>
#include <map>
#include <queue>
#include <algorithm>

typedef long long int lli;
#define PI 3.1415926535897932
#define MAX(a,b) ((a>b)?(a):(b)) // ?????§????????????
#define MIN(a,b) ((a<b)?(a):(b)) // ????°?????????????
#define INRANGE(a,b,c) ((a<=b&&b<=c)?(1):(0)) // a<=b<=c??????????????????????????????

int zeller(int y,int m,int d){ // ?????§??????
	if(m<3){y--; m+=12;}
	return (y+y/4-y/100+y/400+(13*m+8)/5+d)%7;
}

lli gcd(lli a,lli b){	// ?????§??¬?´???°
	if(b==0) return a;
	return gcd(b,a%b);
}

lli lcm(lli a,lli b){	// ????°???¬?????°
	return a*b/gcd(a,b);
}

int main(void){
	lli a,b;
	while(scanf("%lld %lld",&a,&b)!=EOF){
		printf("%lld %lld\n",gcd(a,b),lcm(a,b));
	}
	return 0;
}