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

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

int main(){
	while(true){
		int a,b;
		cin>>a>>b;
		
		if(cin.eof())
			break;
			
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#define LL long long
int main() {
	LL a, b;
	while (std::cin >> a >> b) {
		LL gcd = __gcd(a, b);
		std::cout << __gcd(a,b) << " " << (a*b) / gcd << std::endl;
	}
	return 0;
}

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

unsigned int GCD(unsigned int, unsigned int);

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

unsigned int GCD(unsigned int a, unsigned int b) {
  unsigned int c;
  do {
    if (a > b) {
      c = a %= b;
    } else {
      c = b %= a;
    }
  } while (c != 0);
  return a != 0 ? a : b;
}

C++: #include <iostream>
int Gcd(int a, int b) // Greatest Common Divisor
{
    if (!a || !b) {
        return 0;
    }
    while (a != b) {
        if (a > b) {
            a -= b;
        } else {
            b -= a;
        }
    }
    return a;
}
int Lcm(int a, int b, int gcd) // Least Common Multiple
{
    if (!a || !b) {
        return 0;
    }
    return (a * b)/gcd;
}
int main()
{
    int a, b;
    int gcd;
    std::cin >> a >> b;
    gcd = Gcd(a, b);
    std::cout << gcd << " " << Lcm(a, b, gcd) << "\n";
}

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!=0){
    q=b/a;
    r=b%a;
    b=a;
    a=r;
    }
    return b;
}

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 <bits/stdc++.h>
using namespace std;

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

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

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(int x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

ll gcd (ll a, ll b) {
  if (a < b) swap(a, b);
  while (b > 0ll) {
    ll tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
};



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

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

  return 0;
};

C++: #include<iostream>

using namespace std;

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

int main(){
  int a,b;
  cin>>a>>b;

  int ans1 = gcd(a,b);
  cout<<ans1<<" "<<a/ans1*b<<endl;
  return 0;
}

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

int main() {
	int a, b, c, d, e, f, g, l;
	while (cin >> a >> b) {
		c = a; d = b;
		e = a; f = b;
		while (1) {
			if (a > b) {
				a %= b;
				if (a == 0) { g = b; break; }
			}
			else if (a<b) {
				b %= a;
				if (b == 0) { g = a; break; }
			}
		}
		while (1) {
			if (c>d) d += f;
			else if (c < d) c += e;
			if (c == d) { l = c; break; }
		}
		cout << g << " " << l << endl;
	}
}

C++: #include <iostream>

#define MAX(x,y) ((x>y)?x:y)
#define MIN(x,y) ((x>y)?y:x)
int main(void)
{
	while(true)
	{
		int x=0,y=0,product;
		std::cin >> x >> y;
		if(std::cin.eof())
			break;
		product = x*y;
		//ユークリッドの何とか
		while(x!=y){
			if(x>y)
				x %=y;
			else
				y %=x;
		}
		std::cout << (int)x << " " << (int)(product/x) << std::endl;//確かGCD*LCMと元の積は等しいはず。
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

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

int main (int argc, char * const argv[]) {
    // insert code here...
    int a, b, c;
	while(cin >> a >> b){
		if(a<b){
			swap(a, b);
		}
		c = gcd(a, b);
		cout << c << " " << a/c*b << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,c,d,e;
	std::cin>>a>>b;
	d=a;
	e=b;
	if(b>a){
		d = a;
		a = b;
		b = d;
	}
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	}
std::cout<<a<<" "<<((e/a)*(d/a)*a);
}

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 y;
	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("%d%d", &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("%d %d\n", max[j], min[j]);
	}

	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<stdio.h>
#include<algorithm>
using namespace std;

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

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			x = x % y; 
			swap(x, y);
		}

		cout << y << " " << (a / y * b) << endl;
	}
}

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

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(1){
	
		int tmp=b;
		b=a%b;
		a=tmp;
		cout<<a<<b<<endl;
		if(b==0)break;
	}
	cout<<a<<" "<<ta*tb/a<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

long long GCD(long long a,long long b)
{
    long long  gcd;
    if(b==0)
        gcd=a;
    else
        gcd=GCD(b,a%b);
    return gcd;
    
}
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;
    }
    return 0;
}