Go: package main

import "fmt"

func GCM(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return GCM(b, a % b)
}

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d", G, L)
	}
}

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

template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class itr, class func> void array_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr, class func> void nint_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += string(out(*i)) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)

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

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

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

    return gcd(b, a%b);
}

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

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

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

int main (int argc, char const* 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 LCM(int n, int m);

int main()
{
  int a, b, lcm;
  long long gcd;
  while (cin >> a >> b){
    if (a > b){
      int c = a;
      a = b;
      b = c;
    }
    lcm = LCM(a, b);
    gcd = a * b / lcm;

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

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

C++: #include <cmath>
#include <cstdlib>
#include <cstdio>

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

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

  while( std::cin >> a >> b ) {
    x = a;
    y = b;

    if( x < y ) std::swap(x, y);

    while( y != 0 ) {
      x %= y;
      std::swap(x, y);
    }

    gcd = x;
    lcm = (a / gcd) * b;

    std::cout << gcd << " " << lcm << std::endl;
  }  

  return 0;
}

C++: #include <iostream>

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){
	if(a < b) swap(a, b);
	while(a = a % b){
		if(a < b) swap(a, b);
	}
	return b;
}

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

C++: #include <bits/stdc++.h>

typedef long long ll;

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

int main(){
    ll a,b;
    while(std::cin >> a >> b){
        ll c = gcd(a,b);
        std::cout << c << " " << a/c*b << std::endl;
    }
    return 0;
}

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

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

int main() {
	long a,b,G;
	while (cin>>a>>b){
	long c = 1;
	for (c = 1;c <= b ;c= c+1){
		if(a%c == 0 , b%c == 0){
			G = c;
		}
	}cout<<G<<" "<<a*b/G<<endl;
	}
}

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

using namespace std;

int main(void){

	int a,b,r;
	int tmp;
	double g,l;
	double tmpa,tmpb;

	while(cin>>a>>b){
		tmpa=a;
		tmpb=b;
		r=1;
		while(r){
			if(a<b){
				tmp=a;
				a=b;
				b=tmp;
			} 
			r=a%b; a=b; b=r;	
		}
		g=a;
		l=tmpa*tmpb/g;
		//cout.unsetf(ios::scientific);
		cout << fixed << setprecision(0) << g << ' ' << l << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <math.h>
#define eps 1e-9
using namespace std;
long long int gcd(long long int a,long long int b)
{
    return b?gcd(b,a%b):a;
}
int main()
{
    long long int x,y;
    while(cin >> x >> y)
    {
        cout << gcd(x,y) << " " << x*y/gcd(x,y) << endl;
    }
    return 0;
}

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

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

int main(){
    int m,n;
    long p;
    int k;
    while(cin>>m>>n){
        p=m*n;
        k=Gcd(m,n);
        cout<<k<<" "<<p/k<<endl;
    }
}

C++: #include<stdio.h>
int main(){
	int a,b,x,y;
	scanf("%d%d",&a,&b);
	x=a;
	y=b;
	while(a!=b){
		if(a>b){a-=b;}
		else {b-=a;}
	}
	printf("%d %d",a,x*y/a);
	return 0;
}

C++: 
int main(){
	int a,b;
	int gcd,lcm,hoge;
	while(cin >> a >> b){
		if (a > b) {
			hoge = a;
			a = b;
			b = hoge;
		}
		for (int i=1;i < a;i++){
			if (a%i==0 && b%i==0){
				gcd = i;
			}
		}
		for (int j=a;1;j++){
			if (j%a==0 && j%b==0){
				lcm = j;
				break;
			}
		}
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

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


int main()
{
	int a, b;
	while(cin>>a>>b)
	{
		int i = a;
		while (a%i != 0 || b % i != 0)
			i--;
		int j = a;
		while (j%a != 0 || j % b != 0)
			j++;
		cout << i << " " << j << endl;
	}
    return 0;
}

C++: #include <cstdio>
#define LOOP(index,times) for(int index=0;index<times;index++)
using namespace std;

int main(){
long a,b,r;
while(scanf("%ld %ld",&a,&b) != EOF){
	
	long c=a*b;
			
	if(b>a){r=a; a=b; b=r;}

	LOOP(i,a%b!=0){
	r=a%b;
	a=b; b=r;		
	}
	printf("%ld %ld\n",a%b,c/(a%b));
}
return 0;		
}

C++: #include <iostream>

#define CASE long int

using namespace std;

CASE GCD(CASE x, CASE y)
{
	if (x == 0 || y == 0)
		return x + y;
	else
	{
		if (x >= y)
		{
			x = x - y;
			GCD(x, y);
		}
		else
		{
			y = y - x;
			GCD(x, y);
		}
	}
}

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