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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<ll> vecll;
typedef vector<string> vecs;
template<class T,class U> using Hash=unordered_map<T,U>;

#define REP(i, a, n) for(ll i = a; i < (ll)n; i++)
#define RREP(i, a, n) for(ll i = n-1; i >= (ll)a; i--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, 0, n)
#define MD 1000000007

template<class T> T read(){T a;cin >> a;return a;}
template<class T> void read(T& a){cin >> a;}
template<class T, class ...Args> void read(T& a, Args&... args){cin >> a; read(args...);} 
template<class T> void rarr(T a, int n){for(int i = 0; i < n; i++) {cin >> a[i];}}
template<char c = ' ',class T> void write(T a){cout << fixed << setprecision(4) << a << endl;}
template<char c = ' ',class T,class ...Args> void write(T a, Args... args){cout << fixed << setprecision(4) << a << c; write<c>(args...);}
template<class T> void warr(vector<T> a, const char* c = " "){cout << a[0];for(int i = 1; i < (int)a.size(); i++)cout << c << a[i];cout << endl;;}
template<class T> void warr(T a, int n, const char* c = " "){cout << a[0];for(int i = 1; i < n; i++)cout << c << a[i];cout << endl;}
void split(string s, string delim, veci& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(atoi(s.substr(pos).data()));break;}else {result.push_back(atoi(s.substr(pos, p - pos).data()));}pos = p + delim.size();}}
void split(string s, string delim, vecs& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(s.substr(pos));break;}else {result.push_back(s.substr(pos, p - pos));}pos = p + delim.size();}}
ll gcd(ll a, ll b){while(true){ll k = a % b;if(k == 0)return b;a = b;b = k;}}
ll comb(ll n, ll m){ll p=1;m=min(m,n-m);for(ll i=1;i<=m;i++){p*=n-i+1;p/=i;}return p;}

int main(void)
{
    while(!cin.eof()){
        ll a,b;
        read(a,b);
        ll r1=gcd(a,b);
        ll r2=a*b/r1;
        write(r1,r2);
    }
    return 0;
}

C++: #include<iostream>
int GCD(long long int x,long long int y){
	while(x%y!=0){
		long long int z=x%y;
		x=y;
		y=z;
	}
	return y;
}
int main(){
	long long int a=0,b=0;
	while(std::cin>>a>>b){
		int c=GCD(a,b);
		long long int d=a*b/c;
		std::cout<<c<<" "<<d<<std::endl;
	}
	
	return 0;
}

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>>b,a!=EOF) {
		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 << "1" << " " << a << endl;
		}
	}
	return 0;
}

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

int main(){
	long a,b,tmp,i;
	
	while(cin>>a>>b){
		if(a>=b) i=b;
		else i=a;
		
		for(;0!=(a%i)+(b%i);i--);
		cout<<i<<" "<<a*b/i<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

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

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

int main()
{
    int a,b;
    while(scanf("%d%d",&a,&b) > 0){
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
    return 0;
}

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

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

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

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

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

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

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

long long gcd(long long a, long long b)//??相除法求最大公?数
{
	if (b == 0)return a;
	return gcd(b, a%b);
}

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

int main(int argc, char *argv[])
{
	long long a, b;
	while (cin >> a >> b)
	{
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}

	return 0;
}

C++: #include <stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
unsigned long int gcd(unsigned long int a,unsigned long int b)
{
 if(b==0)
 return a;
 else
 return gcd(b,a%b);

}
unsigned long int lcm(unsigned long int a,unsigned long int b)
{

 return a/gcd(a,b)*b;

}
int main() {
 unsigned long int a,b;

   while(cin>>a>>b)
   {
    

    cout<<gcd(a,b)<<" "<<lcm(a,b)<<"\n";
   }
    return 0;
}

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

int GCD(int a, int b)
{
	if (b > 0) {
		return GCD(b, a%b);
	}else {
		return a;
	}
}

int LCM(int a, int b)
{
	return a*b / GCD(a, b);
}

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

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

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

using namespace std;

int a, b;
int gcd, lcm;

void GCD(){

	int big, small;

	big = a;
	small = b;

	while (big) {
		if (small > big) swap(big, small);
		big = big % small;
	}
	gcd = small;

}

void LCM() {
	lcm = a * b / gcd;
}




int main(){
	while (cin >> a >> b) {

		GCD();
		LCM();
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main(void)
{
	int a, b,r,i,small,big,x;

	while (scanf("%d %d", &a, &b) != EOF){
		if (a > b){
			small = b;
			big = a;
		}
		else {
			small = a;
			big = b;
		}

		//?????§??¬?´???°
		r = big % small;
		while (1){
			x = small % r;
			if (x == 0){
				printf("%d ", r);
				break;
			}
			r = x;
			small = r;
		}
		//????°???¬?????°
		r = big % small;
		while (r != 0){
			big = small;
			small = r;
			r = big % small;
		}
		
		printf("%d\n", (a * b) / small);
	}
	return 0;
}