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<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)
{
  int i;
  for(i=1;i<=y;i++)
    {
      if((x%i)%y == 0)
	return x*i;
    }
  return x*y;
}



int main(void)
{
  int a,b,k;
  while(scanf("%d %d",&a,&b) != EOF)
    {
      if(a<b){
	 k = b;
	b = a;
	a = k;
      }
      printf("%d %d\n",GCD(a,b),LCM(a,b));
    }
}

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

using namespace std;

int GCD (int a, int b) {
    while (1) {
        if (a < b) swap(a, b);
        if (b == 0) break;
        a = a % b;
    }
    return a;
}

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

int main (void) {
    int a, b;
    while (1) {
        cin >> a;
        cin >> b;
        if (cin.eof()) break;
        cout << GCD(a, b) << ' ' << LCM(a, b) << endl;
    }
    return 0;
}

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

int gcd(int a, int b){
    assert(a>=0 && b >=0);
    if(a < b){
        return gcd(b,a);
    }
    if(b == 0){
        return a;
    } else {
        return gcd(b,a%b);
    }
}

int lcm(int a, int b){
    assert(a>=0 && b >=0);
    if(b == 0){
        return a;
    } else {
        return gcd(b,a%b);
    }
}

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

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

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

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

long gongyueshu(long a,long b);
int  main()
{
	long  a,b,c,d;
	while((cin>>a>>b)&&a!=EOF&&b!=EOF)
	{
	

	c=gongyueshu(a,b);
	d=a/c*b;
	
	cout<<c<<" "<<d<<endl;
}
	
	
} 
long gongyueshu(long a,long b)    //----------找最大公?数   最小公倍数=?数的乘?/最大公?数
{
	if(a%b==0)
  return b;
 return gongyueshu(b,a%b);
}

C++: #include <cstdio>

int main()
{
        unsigned long a, b;

        while (scanf("%lu %lu", &a, &b) != EOF) {
                unsigned long max = (a > b) ? a : b,
                                          min = (a < b) ? a : b;
                while (min) {
                        int r = max % min;
                        max = min;
                        min = r;
                }
                unsigned long lcm = a * b / max;
                printf("%lu %lu\n", max, lcm);
        }

        return 0;
}

C++: #include<iostream>
#include<list>
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) > (b) ? (b) : (a))
using namespace std;


int main(){
	long a,b,r,x,y;
	list<long> aby;
	
	while(!(cin>>a>>b).eof()){
		x=a,y=b;
		while(1){
			r=MAX(x,y)%MIN(x,y);
			if(r==0) break;
			x=MIN(x,y);
			y=r; 
		}
		aby.push_back(a);
		aby.push_back(b);
		aby.push_back(MIN(x,y));
		
	}
	list<long>::iterator it = aby.begin();
	while(it != aby.end()){
		a = *it, it++;
		b = *it, it++;
		y = *it;
		cout << y << " "<<(a*b)/y <<endl;
		it++;
	}
	
	return 0;
}

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

int main(){
   int a,b;
   int A,B;
   int GCD,LCM;
   int z;
   
   while(cin>>A>>B){
      if(A<B){
         z = A;
         A = B;
         B = z;
      }
      a = A;
      b = B;
   
      while(1){
         if(a%b == 0){
            GCD = b;
            break;
         }
         z = a%b;
         a = b;
         b = z;
      }
      LCM = A*B/GCD;
      
      printf("%d %d\n",GCD,LCM);
   }
   return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int a,int b){
    while(a>0||b>0){
        if(a>b)
            a%=b;
        else
            b%=a;
    }
    if(a==0)
        return b;
    else if(b==0)
        return a;
}
int main(){
    int a,b;
    while(cin>>a>>b){
        int c=gcd(a,b);
        int lcm=(a*b)/c;
        cout<<c<<" "<<lcm<<endl;
    }
    return 0;
}

C++: #include <cstdio>

int main()
{
    int a, b;
    int m, n, temp;

    while (scanf("%d %d", &a, &b) != EOF) {
        m = a;
        n = b;
        if (m < n) {
            temp = m;
            n = m;
            m = temp;
        }

        while (n > 0) {
            temp = n;
            n = m % n;
            m = temp;
        }

        printf("%d %d\n", m, a / m * b);
    }

    return 0;
}

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

typedef long long lli;

lli gcd(lli a, lli b) { return b == 0 ? a : gcd(b, a%b);}

int main(){
  lli a,b;
  while(cin >> a >> b)
    cout << gcd(a,b) << ' ' << a * b / gcd(a,b) << endl;
}

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

C++: #include "bits/stdc++.h"
using namespace std;

long long int gcd(long long int l, long long int r) {
	assert(l > 0 && r > 0);
	if (l > r)return gcd(r, l);
	else {
		const long long int num = r%l;
		if (num) {
			return gcd(l, num);
		}
		else {
			return l;
		}
	}
}
long long int lca(long long int l, long long int r) {
	return l / gcd(l, r)*r;
}
int main() {
	long long int a, b;
	while (cin >> a >> b) {
		cout << gcd(a, b) << " " << lca(a, b) << endl;
	}
	return 0;
}

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

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    //gcd = u(a, b);
   // lcm = l(a, b);
//printf("%d %d\n",gcd, lcm);
    //std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0){return i;}
      else{i++;}
    }else{
      i++;
    }
  }
}

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

int main()
{
	for (unsigned long a, b, x, r; cin >> a >> b; cout << a << ' ' << x << endl) {
		unsigned long at = a, bt = b;
		do {
			r = a%b;
			a = b;
			b = r;
		} while (r);
		x = at / a *bt;
	}
	return 0;
}

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

int gcd(int a, int b)
{
    if (a > b) {
        return gcd(b, a);
    }

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

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

        cout << gcd_thereof << " ";

        a /= gcd_thereof;
        b /= gcd_thereof;

        cout << a * b * gcd_thereof << endl;
    }
}

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 <stdio.h>
using namespace std;

int gcd(long num1,long num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(long num1,long num2) {
	return num1 / (double)gcd(num1, num2) * num2;
}

int main() {
	long a, b;
	while (~scanf("%d %d",&a,&b)) {
		printf("%d %d\n", gcd(a, b),(long)lcm(a,b));
	}
}