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 <cstdio>
#define LOOP(index,times) for(int index=0;index<times;index++)
using namespace std;

int main(){
long a,b,r;
while(scanf("%ld %ld",&a,&b) != EOF){
	
	long c=a*b;
			
	if(b>a){r=a; a=b; b=r;}

	while(1){
	r=a%b;
	if(r==0) break;
	a=b; b=r;		
	}
	printf("%ld %ld\n",b,c/b);
}
return 0;		
}

C++: #include "stdio.h"

int main()
{
	int a, b, x, y;

	while(scanf("%d %d", &a, &b) != EOF){
		if(a < b) {int t; t = a; a = b; b = t;}

		for(int i = a-b; i > 0; i--){
			if(a%i == 0 && b%i == 0) {x = i; break;}
		}

		y = a/x*b;

		printf("%d %d\n", x, y);
	}

	return 0;
}

C++: #include<stdio.h>

long gcd(long a,long b);

int main(){
  /*
  int a = 0,b = 0,c = 0,d = 0,e = 0,f = 0;

  while(fscanf(stdin,"%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f) != EOF){
    printFunc(a,b,c,d,e,f);
  }
  */

  long a = 0,b = 0;

  while(fscanf(stdin,"%d %d",&a,&b) != EOF){
    printf("%d %d",gcd(a,b),a*b/gcd(a,b));
  }

  return 0;
}

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

C++: #include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <string>

using namespace std;
int main()
{

double x,y,r,a,b;

cin>>x>>y;
a=x;
b=y;
while(x%y!=0)
{
r=x%y;
x=y;
y=r;
}
cout<<y<<" "<<a*b/y<<endl;
return 0;
}

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

int main() {
	long a,b;
	long c= a,d = b;
	while (cin>>a>>b){
	while(true){
		if(c%d == 0)break;
		d = c % d;
		c = d;
	}
	}cout<<d<<" "<<a*b/d<<endl;
}

C++: #include <iostream>

int get_GCD(u_int a, u_int b)
{
    while(a != 0 && b != 0){
        if(a >= b)
            a %= b;
        else
            b %= a;
    }
    return a != 0 ? a : b ;
}

int main()
{
    u_int a, b, GCD;
    while(std::cin >> a >> b){
            GCD = get_GCD(a, b);
            std::cout << GCD << " " << a * (b / GCD) << std::endl;
    }    

    return 0;
}

C++: #include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<algorithm>

int gcd(int a, int b)
{
if(b==0)
return a;
else
return gcd(b,a%b);
}
int main()
{
int x,y,z,lcm;
while(x!=0||y!=0){
scanf("%d%d",&x,&y);
z=gcd(x,y);
lcm=(x*y)/z;
printf("%d %d\n",z,lcm);
}
return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long int ll;
void solve(ll a ,ll b)
{
    ll a1=a,b1=b,t;
    while(b1!=0){//cout<<a1<<" ! "<<b1<<endl;
        t=b1;
        b1=a1%b1;
        a1=t;

    }
    cout<<a1<<" "<<a*b/a1<<endl;
}
int main()
{
    ll a,b;
    while(cin>>a>>b)
    {
        if(a<b)swap(a,b);
        solve(a,b);
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
using lli = unsigned long long int;

lli GCD(lli a,lli b);
lli LCM(lli a,lli b);

int main(){
    lli a,b;
    while(cin>>a>>b){
        cout << GCD(a,b) << " " << LCM(a,b) << endl;
    }
    return 0;
}

lli GCD(lli a,lli b){
    if(a<b)
        swap(a,b);
    lli r = 1;
    while(r!=0){
        r = a%b;
        a = b;
        b = r;
    }
    return a;
}

lli LCM(lli a,lli b){
    return a*b/GCD(a,b);
}

C++: #include<iostream>

using namespace std;

int main() {
	int a, b, c, d, i, m;
	while (cin >> a >> b) {
		for (i = 0;i < b;i++) {
			for (m = 0;m < a;m++) {
				if (a*(i + 1) == b*(m + 1)) {
					c = a*(i + 1);
					i = -1;
					break;
				}
			}
			if (i == -1) { break; }
		}
		if(a > b){
			for (i = a;i > 0;i--) {
				if (a%i == 0 && b%i == 0) { break; }
			}
		}else{
			for (i = b;i > 0;i--) {
				if (b%i == 0 && a%i == 0) { break; }
			}
		}
		d = i;
		cout << c << ' ' << d << endl;
	} 
	return 0;
}

C++: #include <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <iomanip>


using namespace std;


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

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

int main(){
	long long a, b, t, gcd, lcm;
	while( cin >> a >> b ){
		t=a*b;
		while(a!=b){
			while(a>b) a-=b;
			while(a<b) b-=a;
		}
		gcd=a;
		lcm=t/gcd;
		cout << gcd << " " << lcm << endl;
	}
 return 0;
}

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

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


int main() {
  long long int n, m;
  while ((cin >> n >> m)) {
    long long int gcd_nm = gcd(n, m);
    long long int lcm_nm = n * m / gcd_nm;
    cout << gcd_nm << " " << lcm_nm << endl;
  }
}

C++: #include<iostream>

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

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

int main(){
    int a,b;
    while(cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cin >> a >> b;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

C++: #include<stdio.h>
int gcd(int x,int y){
	int r,m;
	if(x < y){
		m=x;
		x=y;
		y=m;
	}
	while(y > 0){
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
int main()
{
	unsigned long long int a,b,x,n;
	while(scanf("%lld%lld",&a,&b)!=EOF){
		x=gcd(a,b);
		printf("%lld ",x);
		n=a/x*b;
		printf("%lld\n",n);
	}
	return 0;
}

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

long int key(long int x,long int y);

int main(void) {

  long int a,b;

  while(cin >> a >> b){


    long int gcd = key(a,b);
    long int a2 = (long int)(a/gcd);
    long int b2 = (long int)(b/gcd);
    long int lcm = gcd * a2 * b2;

    printf("%ld %ld\n",gcd,lcm);
  }

  return 0;
}

long int key(long int x,long int y){

  if(y == 0){//???????????´??°???0??????????????§??¬?´???°???0
    return x;
  }else{
    return key(y, x % y);
  }
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int gcd(int,int);
int lcm(int,int);
int tes(int,int);

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

int gcd(int a,int b){
  int n;
  n=min(a,b);
  for(int i=n;i>=1;i--){
    if(a%i == 0 && b%i==0)return i;
  }

}

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

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

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

long long GCD(long long a, long long b){
	long long r,temp;
	if(a<b)swap(a,b);
	while(b!=0){
		temp=b;
		b=a%b;
		a=temp;
	}
	return a;
}

int main(){
	long long a,b,r;
	while(cin>>a>>b){
		cout<<GCD(a,b)<<' '<<a*b/GCD(a,b)<<endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(){

	int a = 0, s = 0, d = 0, f = 0, A = 0, S = 0;


		A = a;
		S = s;

		if (a < s){
			d = a;
			a = s;
			s = d;
		}
		while (1){
			if (s == 0){ break; }
			f = a%s;
			a = s;
			s = f;
		}

		printf("%d ", a);

		printf("%d\n", A*S / a);
	

	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int a, b, c, r;
	int gcd, lcm;

	while (cin >> a >> b){
		if (b > a){
			c = a; 
			a = b; 
			b = c;
		}

		lcm = a * b;
		while (1){
			r = a % b;

			if (r == 0){
				break;
			}

			gcd = r;
			a = b;
			b = r;
		}

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

	return 0;
}