Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	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
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

C++: ///
// File:  0005.cpp
// Author: ymiyamoto
//
// Created on Wed Nov  8 22:03:57 2017
//

#include <cstdint>
#include <iostream>

using namespace std;

uint64_t gcd(uint64_t a, uint64_t b)
{
  if (a < b) return gcd(b, a);
  if (b == 0)
    return a;
  else
    return gcd(b, a - b);
}

uint64_t lcm(uint64_t a, uint64_t b, uint64_t g)
{
  return a * b / g;
}

int32_t main()
{
  while (true) {
    uint64_t a, b;
    cin >> a >> b;
    if (cin.eof()) break;
    uint64_t g = gcd(a, b);
    cout << g << " " << lcm(a, b, g) << endl;
  }

  return 0;
}

C++: #include<iostream>
int a,b,t;int g(int a,int b){return a<b?g(b,a):(!b?a:g(b,a%b));}main(){for(;std::cin>>a>>b;std::cout<<(t=g(a, b))<<' '<<(a/t)*b<<"\n");}

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

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

int main()
{
	long long a,b;
	while(scanf("%lld%lld",&a,&b))
	{
		long long t=gcd(a,b);
		printf("%lld %lld\n",t,b/t*a);
	}
	return 0; 
}

C++: #include <stdio.h>

int euclid(int a, int b);

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

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

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

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

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999

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

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

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

C++: #include <iostream>
using namespace std;
 
template<class T> T gcd(T a, T b) {
    return b ? gcd(b, a%b) : a;
}

template<class T> T lcm(T a, T b) {
    return a*b / gcd(a, b);
}
 
int main(int argc, char** argv) {
    unsigned long long a, b;
    while(cin >> a >> b) {
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>

using namespace std;

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



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





}

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*b/n<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
	long long a,b,x,y,n,count=0;
	while(cin>>a>>b){
		if(a==0&&b==0)break;
		if(a>=b){
			x=a;y=b;
		}else{
			x=b;y=a;
		}
		while(1){
			if(y==0)break;
			x=x%y;
			swap(x,y);
		}
		n=a*b/x;
		cout<<x<<" "<<n<<endl;

	}
	return 0;
}

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

int main(){
	int a,b;
	while(cin >> a >> b){
		int gcd = a, lcm;
		while(a%gcd != 0 || b%gcd != 0) gcd--;
		lcm = (a\gcd)*(b\gcd)*gcd;
		cout << gcd <<" "<< lcm << endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
int main(){int a,b;while(2==scanf("%d%d",&a,&b))printf("%d %d\n",std::__gcd(a,b),a/std::__gcd(a,b)*b);return 0;}

C++: #include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<queue>
#include<string.h>
using namespace std;
inline long long gcd(long long  a,long long b)
{return b?gcd(b,a%b):a;}
inline long long lcm(long long a,long long b)
{return a/gcd(a,b)*b;}
long long x,y;
int main()
{
	while(~scanf("%lld %lld",&x,&y))
	{
		printf("%lld %lld\n",gcd(x,y),lcm(x,y));
	}
}

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

using namespace std;

int calc_gcj(int a, int b) {
	int A=0, B=0;
	if (a == max(a,b)) {
		A = a;
		B = b;
	} else {
		A = b;
		B = a;
	}
	if (A == B) return A;
	else return calc_gcj(B,A-B);
	return -1;
}

void solve(int a, int b) {
	int gcj = calc_gcj(a,b);
	int lcm = a/gcj*b;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

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

int GCD(int a, int b)
{
    int c = (a < b)? a : b;
    for (int i = 1; i <= c; ++i) {
        int d = c / i;
        if ( a % d + b % d == 0)
            return d;
    }
    return 1;
}

int LCM(int a, int b)
{
    int c = (a < b)? b : a;
    for (int i = 1; c * i <= 2000000000; ++i) {
        int d = c * i;
        if (d % a + d % b == 0)
            return d;
    }
    return -1;
}

int main(void)
{
    int a, b;
    while (cin >> a >> b)
        cout << GCD(a, b) << " " << LCM(a, b) << endl;
    return 0;
}

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

using namespace std;

int gcd(int, int);
int lcm(int, int);

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

	return 0;
}

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

int lcm(int a, int b){
	int tmp = gcd(a, b);
	return tmp ? (a / tmp * b):0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define repp(i,n) for(int i=1; i<n; i++)
using namespace std;
int Max(int n, int m){
  vector<int> v1;
  vector<int> v2;
  repp(i,n){
    if(n%i == 0) v1.push_back(i);
    if(m%i == 0) v2.push_back(i);
  }
  int t=0;
  rep(i,v1.size()){
    rep(j,v2.size()){
      if(v1[i] == v2[j] && t < v2[j]) t = v2[j];
    }
  }
  return t;
}
int main(){
  int n,m;
  while(cin >> n >> m){
    int a = Max(n,m);
    int b = n/a*m;
    cout << a << " " << b << 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() {
  for(int a, b; cin >> a >> b; ) {
    int g = gcd(a,b);
    cout << g << " " << a / g * b << endl;
  }
}

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

C++: #include<iostream>

int main(){
	long int a, b, r;
	
	while(std::cin >> a >> b){
		long int product = a*b;
		
		// GCD
		if(a < b){
			long int temp = a;
			a = b;
			b = temp;
		}
		while((r = a%b) != 0){
			a = b;
			b = r;
		}
		
		// LCM
		long int lcm = product / b;
		
		// show
		std::cout << b << " " << lcm << std::endl;
	}
	
	return 0;
}}