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>
using namespace std;
int main() {
	long long int a, b, m, n, tmp;
	while(cin >> a >> b) {
		if(a > b) {
			m = a;
			n = b;
		} else {
			m = b;
			n = a;
		}
		while(n != 0) {
			tmp = n;
			n = m % n;
			m = tmp;
		}
		tmp = a * b / m;
		cout << m << " " << tmp << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	unsigned long long a,b,c,d,e,f,maxx=0,data,minn=0,o;
	while (scanf("%llu %llu",&a,&b)!=EOF){
		if (a>b){
			d=a%b;
			if (d==0) maxx=b;
			else{
				maxx=b%d;
				if (maxx==0)maxx=d;
			}
		}
		else {
			d=b%a;
			if (d==0) maxx=a;
			else{
				maxx=a%d;
				if (maxx==0)maxx=d;
			}
		}
		cout<<maxx<<" "<<a*b/maxx<<endl;
		maxx=0;
		minn=0;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<tuple>
#include<utility>
#include<stack>
#include<set>
#include<iomanip>
using namespace std;
using ll=long long int;

ll gcd(ll p, ll q) {
	ll r = p % q;
	while (r != 0) {
		p = q;
		q = r;
		r = p % q;
	}
	return q;
}

ll lcm(ll p, ll q) {
	return p * q / gcd(p, q);
}

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;

int main(){
	int a, b, c, d,r,s,h;
	while (cin >> a >> b){
		//c
		h = a;
		s = b; {
			r = h % s;
			if (r == 0) {
				c = s;
				break;
			}
			h = s;
			s = r;
		}

		//d
		h = a;
		s = b;
		if (a < b){
			for (;;){
				if ((b % a) == 0){
					d = b;
					break;
				}
				b = b + s;
			}
		}
		else if (a >= b){
			for (;;){
				if ((a % b) == 0){
					d = a;
					break;
				}
				a = a + h;
			}
		}

		cout << c << ' ' << d << endl;
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <cmath>
#define EPS 1e-10
using namespace std;
int gcd(int a,int b){
  if(b == 0)return a;
  return gcd(b,a%b);
}
int lcm(int a,int b){
  return (a/gcd(a,b))*b;
}
int main(){
  int a,b;
  while(cin >> a >> b){
    if(a < b)swap(a,b);
    cout << gcd(a,b) << ' ' << lcm(a,b) << endl;

  }
}

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

using namespace std;

int rez(int a, int b)
{


}


int main()
{



}

C++: #include<stdio.h>
#include<stdlib.h>
#include<algorithm>


int yukurid(int, int);

int main()
{
	int a, b;
	while (scanf("%d %d", &a, &b) != EOF)
	{
		int tmp = a;
		a = a < b ? b : a;
		b = tmp < b ? tmp : b;
		printf("%d %d\n", yukurid(a, b),((a*b)/yukurid(a,b)));
	}
	return 0;

}

int yukurid(int a, int b)
{
	int tmp;
	if (a%b == 0)return b;
	else
	{
		tmp = a;
		a = b;
		b = tmp%b;
		return yukurid(a, b);
	}
}

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

C++: #include<iostream>

using namespace std;

int a, b;
int change;
int GCD(int m, int n)
{
	if((0==m)||(0==n))
	{
		return 0;
	}
	while(m!=n)
	{
		if(m>n)
		{
			m=m-n;
		}
		else
		{
			n=n-m;
		}
	}
	return m;
}
int LCM(int m,int n)
{
	if((0==m)||(0==n))
	{
		return 0;
	}
	return m/GCD(m,n)*n;
}
int main()
{
	while(cin>>a>>b)
	{
		printf("%d %d\n",GCD(a,b),LCM(a,b));
	}
}

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

long int Gcm(long int a,long int b){

    long int temp=0;
    long int r=1;
    if(a<b){
        temp = a;
        a = b;
        b = temp;
    }
    while(r!=0){
        r = a%b;
        a = b;
        b = r;
    }
    return a;
}

int main(){
    long int x,y;
    long int gcd,lcm;

    cin >> x >> y;

    gcd = Gcm(x,y);

    x = x/gcd;
    y = y/gcd;

    lcm = x * y * gcd;

    cout <<  gcd <<" "<< lcm << endl;

    return 0;
}

C++: #include<stdio.h>
long long int x,y;
long long int m,n;
long long int ans1,ans2;

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

int main(){
    scanf("%lld%lld",&n,&m);
    if(n<=m){
        ans1=GCD(m,n);
    }
    else{
        ans1=GCD(n,m);
    }
    ans2=m*n/ans1;
    printf("%lld %lld\n",ans1,ans2);
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


V<string> split(const string& s, char c) {
  V<string> res;
  stringstream ss(s);
  string t;
  while (getline(ss, t, c)) res.push_back(t);
  return res;
}

int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  string s;
  while (getline(cin, s)) {
    auto ss = split(s, ' ');
    lint a = stoll(ss[0]), b = stoll(ss[1]);
    lint g = __gcd(a, b);
    lint l = a * b / g;
    cout << g << ' ' << l << '\n';
  }
}

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

#define REP(i, s, n) for(int i = s; i < n; ++i)
#define rep(i, n)		 REP(i, 0, n)
#define SORT(c)			 sort((c).begin(), (c).end())
#define IINF					INT_MAX
#define LLINF					LLONG_MAX
#define DEBUG					false

int main(){
    long long int a,b,r=1;
    while(cin>>a>>b){
    if(a<b){
        long long int temp;
        temp=b;
        b=a;
        a=temp;
    }
    long long int tempa=a,tempb=b;
    r=b;
    b=a;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;

    }
    long long ans=tempa*tempb/b;
    cout<<b<<" "<<ans<<endl;
    return 0;
}
}

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = min(temp_a, temp_b);
		lcm = (a / gcd) * b;
		cout << gcd << " "<< lcm << endl;

		a = 0, b = 0;
	}

	//getchar();

	return 0;
}

C++: #include<iostream>
#include<math.h>
#include<cstdio>
using namespace std;
int main(){
	while(1){
		long long a,b;
		cin>>a>>b;
		long long c=a*b;
		long temp;
		if(a<b){temp=a;a=b;b=temp;}
		if(cin.eof()) {break;}
		long q,r;
		while(a%b!=0){
			q=(long long)a/b;		
			r=(long long)a%b;
			a=b;
			b=r;
		}
		cout<<b<<" "<<c/b<<endl;		
	}
	return 0;	
}

C++: #include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int main(){
	int a,b;
	while(cin>>a>>b) printf("%d %d\n",gcd(a,b),a/gcd(a,b)*b);
	return 0;
}

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

int main() {
	int a,b,c;
	while(cin>>a>>b){
		int g=0,l=0;
		if(a<b){
			c=b;
			b=a;
			a=c;
		}
		while(1){
			int i=1;
			if((i*a)%b==0){
				g=i*a;
			}
			if(g==i*a) break;
			i=i+1;
		}
		while(1){
			int i=2;
			if(a%i==0){
				if(b%(a/i)==0){
					l=a/i;
				}
			}
			i=i+1;
			if(l!=0) break;
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int main(){
  int m,n;
  while(cin>>m>>n){
    cout << gcd(m,n) << ' ' << lcm(m,n) << endl;
  }
}