Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [100]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == 0 {
			break
		}
		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++: #include <iostream>
using namespace std;

int  gcd(int m, int n);
int lcm(int m,int n);

//?????§??¬?´???°??¨????°???¬?????°????±???????
int main()
{
	int a[50],b[50];
	int set = 0;
	while( cin >> a[set] >> b[set]){
		set++;
	}
	for(int i = 0;i < set; i++){
		cout << gcd(a[i], b[i]) << " " << lcm(a[i], b[i]) << endl;

	}

	return 0;
}

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);
}

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

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

long long lcm(long long a, long long b) {
    assert(a > 0 && b > 0);
    return (a / gcd(a, b)) * b;
}

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

C++: #include <iostream>
using namespace std;
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))

int gcd(int x,int y){
    if (y==0)return x;
    return gcd(MIN(x,y), MAX(x,y)%MIN(x,y));
}

int lcm(int x,int y){
    return x * y / gcd(x,y);
}

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define mp make_pair



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

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

int main(void){
  long long int x,y,g,l,t;
  while(cin >> x >> y){
    if(x<y)
      swap(x,y);
    g=__gcd(x,y);
    l=x*y/g;
    cout << g << " " << l <<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

lld gcd(lld x,lld y)
{
	if (y == 0)
	{
		return x;
	}
	return gcd(y,x%y);
}

int main()
{
	lld a,b;
	while(cin >> a >> b)
	{
		lld n = min(a,b);
		lld m = max(a,b);
		lld sol = gcd(m,n);
		cout << sol << endl;
		cout << (n * m) / sol << endl;
	}


	return 0;
}

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

int main(){
	long long a,b;
	while(cin >> a >> b){
		vector<int> num;
		int k = 0;
		long long max = 1;
		for(int i = 2; i < a/2; i++){
			if(a % i == 0){
				num.push_back(i);
				k++;
			}
		}
		for(int i = 0; i < k; i++){
			if(b % num[i] == 0){
				max = num[i];
			}
		}
		long long min = (a * b) / max;
		cout << max << " " << min << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main( void )
{
	long a, b;
	while(cin >> a >> b) {
		long aa, bb, cc;
		aa = a; bb = b;
		while(bb) {
			cc = aa % bb;
			aa = bb;
			bb = cc;
		}
		cout << aa << ' ' << a*(b/aa) << 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){
		int d;
		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<cmath>
#include<stdio.h>
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){
			y = x % y;
		}

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

}

C++: #include <iostream>

using namespace std;

int main () {
    while (!cin.eof()) {
        int num1;
        int num2;
        cin >> num1 >> num2;
        int a = num1, b = num2;
        if (a<b) {
            a = num2;
            b = num1;
        }
        int q = a/b, r = a%b;
        while (r != 0) {
            a = b;
            b = r;
            q = a/b;
            r = a%b;
        }
        a = num1/b;
        cout << b << " " << a*num2 << endl;
        
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int getGCD(int a, int b)
{
	if (a > b)
	{
		swap(a, b);
	}
	return (a == 0) ? b : getGCD(a, b % a);
}

int main()
{
	int a, b;
	for (; cin >> a >> b;)
	{
		int gcd = getGCD(a, b);
		cout << gcd << " " << (a / gcd) * b << endl;
	}
}

C++: #include <iostream>
#include <cmath>
using namespace std;
typedef unsigned long long ULL;

inline ULL GCD(ULL a,ULL b)
{
    ULL res=0;
    if(a != b)
    {
        if(a > b) 
        {
            if(a % b == 0)
            {
                return b;
            }
            else
            {
                GCD(b,(a % b));
            }

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

        }
    }
    else
    {
        return a;
    }
}
inline ULL LCM(ULL a,ULL b)
{
    ULL l  = GCD(a,b);
    ULL l1 = a / l;
    ULL l2 = b / l;
    return l * l1 * l2;
}
int main()
{
    ULL a,b;
    while(cin >> a >> b)
    {
        cout << GCD(a,b) << " " << LCM(a,b) << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
#define DBG cout<<"!"<<endl;
int main(){
  int a,b,c,max=0,min=0,bet,les,ch1=0,ch2=0;
  vector<int> ayaku;
  vector<int> byaku;
  while(cin>>a>>b){
    bet=a%b;
    les=b%bet;
    if(les==0)
      max=bet;
    else{
    for(int i=1;i<=bet;i++){
      if(bet%i==0)
	ayaku.push_back(i);
    }
    for(int i=1;i<=les;i++){
      if(les%i==0)
	byaku.push_back(i);
    }
    for(int i=0;i<ayaku.size();i++){
      for(int j=0;j<byaku.size();j++){
	if(ayaku[i]==byaku[j]&&ayaku[i]>max)
	  max=ayaku[i];
      }
    }
    }
    min=(a/max)*b;
    cout<<max<<" "<<min<<endl;
  }
  return 0;
}

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

int main(){
	long long a,b,GCD,LCM,x,a2,b2;

	cin>>a>>b;
	a2=a;
	b2=b;
	while(a!=b){
		if(a>b){
			x=a-b;
			a=b;
			b=x;
		}
		else if(b>a){
			x=b-a;
			b=a;
			a=x;
		}
	}
	GCD=a;
	LCM=a2*b2/a;

	cout<<GCD<<" "<<LCM<<endl;

	return 0;
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

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

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