Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Printf("%d %d\n", y, lcm/y)
	}
}

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

int main()
{
	int lam,gcd,a,b,c,d;
	while(cin>>a>>b)
	{
		c=a;
		d=b;
		if(a<b)
		{
			a=a+b;
			b=a-b;
			a=a-b;
		}
		while(a%b!=0)
		{
			int temp;
			temp=b;
			b=a%b;
			a=temp;
		}
		gcd=b;
		lam=d/gcd*c;
		printf("%d %d\n",gcd,lam);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
	while(cin >> a >> b) {
	  cout << __gcd(a, b) << " " << (a*b)/__gcd(a, b) << endl;
	}
  return 0;
}

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

unsigned int gcd(const unsigned int a, const unsigned int b) {
	unsigned int result = 1;
	unsigned int k = (a < b) ? a : b;

	for (unsigned int k = 1; k <= a and k <= b; k++) {
		if (a % k == 0 and b % k == 0) { result = k; }
	}

	return result;
}

unsigned int lcm(unsigned int a, unsigned int b) {
	unsigned int mult;

	if (a > b) {
		unsigned int tmp = a;
		a = b;
		b = tmp;
	}

	for (unsigned int k = 1; k <= a; k++) {
		mult = b * k;
		if (mult % a == 0) { return mult; }
	}

	return 0;
}

int main() {
	unsigned int a, b;
	
	while (!std::cin.eof()) {
		std::cin >> a >> b;
		std::cout << gcd(a, b) << " " << lcm(a, b) << std::endl;
	}
}

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

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

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

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

C++: #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <limits.h>
#include <math.h>

#include <iostream>
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

#define FOR(i,s,e) for((i)=(s);(i)<(int)(e);(i)++)

typedef long long ll;

int extgcd(int a, int b, int &x, int &y) {
	int res = a;
	if (b) {
		res = extgcd(b, a % b, y, x);	
		y -= (a/b) * x;
	} else {
		x = 1;
		y = 0;
	}
	return res;
}

int main() {
	int a, b;
	int x, y;
	int gcd, lcm;
	while (scanf("%d%d ", &a, &b) != EOF) {
		if (a >= b) {
			gcd = extgcd(a, b, x, y);
		} else {
			gcd = extgcd(b, a, x, y);
		}

		lcm = a / gcd * b;
		printf("%d %d\n", gcd, lcm);
	}

	return 0;
}

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

#define MAX 256

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

int main(void){
	
	long max[50], min[50];
	for (long i = 0; i < 50; i++){
		max[i] = 0;
		min[i] = 0;
	}

	long a, b;
	long i = 0;

	while (scanf("%ld%ld", &a, &b) != EOF){
		max[i] = f(a, b);
		long j = 1;
		while (min[i] == 0){
			if ((a*j) % b == 0)min[i] = a*j;
			j++;
		}
		i++;
	}

	for (long j = 0; j < i; j++){
		printf("%ld %ld\n", max[j], min[j]);
	}

	return 0;
}

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

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

C++: #include <cstdio>

typedef long long ll;

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

ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}
int main(int argc, char const *argv[])
{
	ll x, y;
	while(~scanf("%I64d %I64d", &x, &y))
	{
		printf("%I64d %I64d\n", gcd(x, y), lcm(x, y));
	}
	return 0;
}

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

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

int main(){
	int a, b;
	int gcd, lcm;
	int sub;
	
	while((scanf("%d", &a)) != EOF){
		scanf("%d", &b);
		
		if(a < b){
			sub = a;
			a = b;
			b = sub;
		}
		
		gcd = Euc(a, b);
		lcm = (a / gcd) * b;
		
		printf("%d %d\n", gcd, lcm);
	}
	
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int a[2];
int main(){
	while(cin>>a[0]>>a[1]){
		sort(a,a+2);
		for(int i=a[0];;i--){
			if(a[0]%i==0&&a[1]%i==0){
				cout<<i<<" "<<(long long)a[0]*a[1]/i<<endl;
				goto loop;
			}
		}
		loop:;
		age:;
	}
	return 0;
}

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

int main(){
  int a, b;
  while(scanf("%d %d", &a, &b) != EOF){
    int gcd=1;
    int n = 2;
    while(a!=1 && b!=1){
      if(a%n==0 && b%n==0){
	a = a/n;
	b = b/n; 
	gcd = gcd * n;
      }
      else{
	if(n > a)
	  break;
	else
	  n++;}
    }
    printf("%d %d\n", gcd, a*b*gcd);
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>

#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF 1<<30
#define ALEN(ARR) (sizeof(ARR) / sizeof(ARR[0]))
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define ll long long
#define ull unsigned long long
#define MOD 1000000007

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(16);

  ll a, b;
  while(cin >> a >> b) cout << __gcd(a, b) << " " << (a * b) / __gcd(a, b) << endl;

  return 0;
}

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

int main(){
	long a,b,c,ab;
	while(cin >> a >> b){
		ab=a*b;
		while(b!=0){
			a=a%b;
			c=b;b=a;a=c;
		}
		cout << a <<" " <<ab/a<<"\n";
	}
return 0;
}

C++: int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	for(int i=0;i<5;i++){
		int a,b;
		std::cin>>a>>b;
		std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl;
		
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <stdint.h>
using namespace std;

template <class T>
T gcd(const T &a, const T &b)
{
  if (b == 0) return a;
  return gcd(b, a % b);
}

template <class T>
T lcm(const T &a, const T &b)
{
  T g = gcd(a, b);
  return a / g * b;
}

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

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

int main(){
   int a, b, tmp, m=0, s=0, ai, bi;
   while(cin >> a >> b){
      ai=a; bi=b;
      while(1){
         if(a<b){
            tmp=a;
            a=b;
            b=tmp;
         }
         if(a%b==0){
            m=b;
            break;
         }else a=a%b;
         
      }
      s=ai*bi/m;
      cout<< m << " " << s << endl;
   }
   return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,g,x,y,L,i=0;
while(cin>>a>>b){
x=a;y=b;
while(1){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
  else if(x==y){g=x;break;}
}
L=(a*b)/g;
cout<<g<<" "<<L<<endl;
x=0;y=0;
  ++i;
  if(i==49){break;}
}
  return 0;
}

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

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

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