Go: package main

import (
	"fmt"
	"bufio"
	"os"
	"strings"
	"strconv"
)

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

C++: #include <iostream>
#include<cstdio>
using namespace std;
long long gcd(int a,int b)
{
    return b==0? a:gcd(b,a%b);
}

long long lcm(int a,int b)
{
    return a/gcd(a,b)*b;
}
int main()
{
    //freopen("in.txt","r",stdin);
    long long a,b;
    while(cin>>a>>b)
    {
        cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
    }


    return 0;
}

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

u_int euclid_alg(const u_int a, const u_int b) {
	return a > b ? a % b : b % a;
}

int main(void) {
	u_int a,b;
	std::vector<u_int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}

	for(int i = 0; i < (int)num.size(); i+=2){
		u_int pro = num[i] * num[i+1];
		while(num[i] != 0 && num[i+1] != 0){
		if(num[i] > num[i+1]){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}

		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < (int)num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}

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

typedef long long ll;

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

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

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

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


int main(){
	int a, b, tmp, x, y, z;
	while (true){
		cin >> a >> b;
		if (cin.eof()){
			break;
		}
		if (a < b){
			 tmp = a;
			 x = b;
		}
		else {
			x = a;
			tmp = b;
		}
		while (tmp != 0) {
			y = tmp;
			tmp = x % y;
			x = y;
		}
		z = a / y * b;
		cout << y << " " << z << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  long int sn = 0;
  long int bn = 0;
  long 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>
#include<stdio.h>

using namespace std;

//最大公約数 gcd
double gcd(double a, double b){
	while (a != b){
		a > b ? a -= b : b -= a;
	}
	if (a == b) return a;
}

//最小公倍数 lcm
double lcm(double a, double b){
	return a*b/gcd(a, b);
}

int main(){
	int a, b;
	while (cin >> a >> b){
		printf("%.0f %.0f\n", gcd(a, b), lcm(a, b));
	}
	return 0;
}

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

int main() {
	int64_t a, b;
	while (cin >> a >> b) {
		int64_t GCD, LCM;
		int64_t n = a,
			m = b;
		while (1) {
			int64_t n = a % b;
			if (!n) {
				GCD = b;
				break;
			}
			else {
				a = b;
				b = n;
			}
		}

		LCM = n * m / GCD;
		cout << GCD << ' ' << LCM << endl;
	}
}

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

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

int lcm(int a, int b)
{
  if (a == 0 || b == 0) return (0);
  return ((a / gcd(a, b)) * b);
}

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

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

using namespace std;


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


    return 0;
}

C++: #include<iostream>

unsigned x,y;

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

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

int main(){
	while(std::cin >> x >> y)
		std::cout << gcd(x,y) << ' ' << lcm(x,y) << std::endl;
	return 0;
}

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

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

int main(void){
   int a, b, tmp;
   if (a < b){
       tmp = b;
	b = a;
	a = tmp;

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

C++: #include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
    if(b==0)
        return a;
    return gcd(b,a%b);  //递归求最大公约数
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;    //递归求最小公倍数
}
int main()
{
    ll a,b;
    while(cin >> a >> b)
    {
        cout << gcd(a,b)<< " "<<lcm(a,b)<<endl;
    }
    return 0;
}

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

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if (a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}

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

C++: #include <stdio.h>
#include <iostream>
#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);
    std::cout << lcm << " " << gcd << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a %= b;
    }else{
      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;

void keisann(int a, int b) {
	long long ac = a;
	long long bc = b;
	bool d = true;
	do {
		a = a%b;
		if (a == 0) {
			cout << b << " ";
			cout << (ac*bc) / b << endl;
			d = false;
			continue;
		}
		b = b%a;
		if (b == 0) {
			cout << a << " ";
			cout << (ac*bc) / a << endl;
			d = false;
			continue;
		}
	} while (d == true);
}

int main()
{
	int a, b;
	while (cin >> a, a != EOF) {
		cin >> b;
		if (a > b) { keisann(a, b); }
		else if (a < b) {
			int c = a;
			a = b;
			b = c;
			keisann(a, b);
		}
		else if (a == b) {
			cout << a << " " << a << endl;
		}
	}
	return 0;
}