Go: package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for sc.Scan() {
		var a, b int
		fmt.Sscanf(sc.Text(), "%d %d", &a, &b)
		gcd := gcd(a, b)
		fmt.Printf("%d %d\n", gcd, (a/gcd)*b )
	}
}

func gcd(a int, b int) (gcd int) {
	var i, j, k int
	if a > b {
		i = a
		j = b
	} else {
		i = b
		j = a
	}

	k = i % j

	for k > 0 {
		num := i
		i = j
		j = num % i
		k = i % j
	}

	return j
}

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

int gcd(int a, int b){

int p,q,r;

if(a<b){p=b;b=a;a=p;

}

while((r=b%a)!=0){
   q=b/a;
   b=a;
   a=r;
   }
   return a;

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>

int  main() {

//?????§??¬?´???° =????????????????????????????????????
/*(1) a ??? b ??§???????????????????????? r ?????\????????????
???(2) r ??? 0 ?????? b ????????§??¬?´???°??§?????????????????????????????????
???(3) ????????§????????¨????????°a = b?????°b = r ??¨?????? (1) ???????????????????????????*/

//????°???¬?????° =???a*b???/???a??¨b????????§??¬?´???°?????§?±?????????????
	int a = 0, b = 0, swap, kp,num = 1,osu;
	std::cin >> a >> b;
	if (b >= a) { swap = a; a = b; b = swap; }


	while (num) {
		kp = a%b;
		if (kp == 0) { std::cout << b; num = 0; osu = a*b / kp;
		std::cout << " " << osu << std::endl;
		}
		else { a = b; b = kp; }
	}

	
}

C++: #include<iostream>
using namespace std;
int a=0;
int b=0;
long int c=0;
int n,m;
void koyaku(int i , int j)
{
  if(i == j)return ;
  if(i < j)
    {
      int x = i;
      i = j;
      j = x;
    }

  a = i - j;

  while(1)
    {
      b = j - a;
      
      if(a == b)return ;
    }
}

void kobai(int i , int j)
{
  if(i == j)return ;

  c = i * j / a;
}

int main()
{
  while(scanf("%d %d",&n,&m) != EOF)
    {
      koyaku(n,m);
      kobai(n,m);
      cout << a << " " << c << endl;
    }
}

C++: #include<stdio.h>
#include<string.h>

int GCD(int x,int 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(void)
{
  int a,b;
  while(scanf("%d %d",&a,&b) != EOF)
    {
      if(a<b){
	int k = b;
	b = a;
	a = k;
      }
      printf("%d %d\n",GCD(a,b),LCM(a,b));
    }
}

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

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

void solve()
{
	unsigned long long int a;
	while(cin >> a)
	{
		unsigned long long int b;
		cin >> b;
		if(a < b)
		{
			unsigned long long int temp = a;
			a = b;
			b = temp;
		}
		unsigned long long int g = gcd(a, b);
		unsigned long long int lcm = a * b / g;
		cout << g << " " << lcm << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

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

int main() {
    int a, b;
    while (cin >> a >> b) {
        int g = gcd(a, b);
        int l = a / g * b;
        cout << g << " " << l << endl;
    }
}

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){
	 cout<<gcd(a,b)<<" "<<a*b/gcd(a,b)<<endl;
		}
	}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b,s,m,ta,tb,tmp;
	while(cin>>a>>b){
	ta=a,tb=b;
	s=0,m=0;
	if(a<b)swap(a,b);
	if(a==0||b==0){
	
	}
	else 
	while(true){
		tmp=a;
		a=b;
		b=tmp%a;
		if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
		if(a==0||b==0)break;
	}
		
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
}

C++: # include <iostream>

unsigned long a, b;

unsigned long gcd(unsigned long x, unsigned long y) {
	return (y == 0) ? x : gcd(y, x%y);
}

unsigned long  lcm(unsigned long x, unsigned long y, unsigned long g) {
	return x / g*y;
}

int main() {
	while (1) {
		if (std::cin.eof())
			break;
		std::cin >> a >> b;
		unsigned long res1, ans;
		if (a < b)
			res1 = gcd(b, a);
		else
			res1 = gcd(a, b);
		ans = lcm(a, b, res1);
		std::cout << res1 <<' '<< ans << std::endl;
	}
	return 0;
}

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

long GCD(long, long);
long LCM(long, long);

long gcd, lcm;

int main(){
	long a, b;
	while(cin >> a >> b){
		if(a < b)
			swap(a, b); // a > b
		gcd = GCD(a, b);
		lcm = LCM(a, b);
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

long LCM(long a, long b){
	return a*b/gcd;
}

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

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

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

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

C++: #include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl

int aa[2];

void solve(){
	li a=aa[0],b=aa[1];
	if(a<b)swap(a,b);
	while(a%b!=0){
		int tmp=a%b;
		a=b;
		b=tmp;
	}
	cout<<b<<" "<<aa[0]*(aa[1]/b)<<endl;
}

int main(){
	while(cin>>aa[0]){
		cin>>aa[1];
		solve();
	}
	
	return 0;
}

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

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

C++: #include <stdio.h>

int main(int argc, char *argv[]){
    
    int a, b, r;
    int temp = 0;
    int c, d;
    
    scanf("%d %d", &a, &b);
    c = a;
    d = b;
    if(a < b){
        temp = a;
        a = b;
        b = temp;
    }
    
    r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    
    printf("%d %d\n", b, (int)((double)c/b*d));
    
    return 0;
}

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

int main(){

	int a, b;

	while(std::cin >> a >> b){

		long int minmul = a * b; //least common multiple
		int maxdivi = 1; //greatest common divisor

		if(a == 0 || b == 0){
			std::cout << 0 << " " << 0 << std::endl;

		}else{					//Euclidean Algorithm

			if(b > a)
				std::swap(a, b);

			while(a % b != 0){
				a = a % b;
				if(b > a)
					std::swap(a, b);
			}
		
		maxdivi = b;
		minmul = minmul / maxdivi;

		std::cout << maxdivi << " " << minmul << std::endl;
		}
	}

	return 0;
}

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

int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int main() {
	vector<int>a(2);
	while (cin >> a[0] >> a[1]) {
		sort(a.begin(), a.end());
		int b = gcd(a[1], a[0]);
		cout << b << " " << a[1] * a[0] / b << endl;
	}
}