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>
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 <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<int(n);++i)

ll a,b;
ll tmp;

ll gcd(ll a,ll b){
	if((0==a)||(0==b)) return 0;
	
	while(a!=b){
		if(a>b) a -= b;
		else b -= a;
	}
	return a;
}

ll lcm(ll a,ll b){
	if((a==0)||(b==0)) return 0;
	
	return ((a/tmp) * b);
}

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

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

int main() {
	int a = 0;
	int b = 0;
	int max = 0;
	int d = 1;
	int a_bk = 0;
	int b_bk = 0;

	while (cin >> a >> b) {
		if (a > b) {
			max = b;
		}
		else {
			max = a;
		}
		a_bk = a;
		b_bk = b;
		d = 1;
		for (int c = 2; c <= max; c++) {
			while (a%c == 0 && b%c == 0) {
				a /= c;
				b /= c;
				d *= c;
			}
		}
		a = a_bk / d * b_bk;
		cout << d << ' ' << a << "\n";
	}
	return 0;
}

C++: //#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int long long
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int gcd(int x, int y)
{
	int a = x, b = y, c = a%b;
	while (c != 0)
	{
		a = b;
		b = c;
		c = a%b;
	}
	return b;
}

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

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

	return 0;
}

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

int main() {
	int a, b, gcd, lcm;
	while(cin >> a >> b){
		gcd = 1;
		lcm = 1;
		for(int i = 2; a != 1 || b != 1; i++) {
			while(a % i == 0 || b % i == 0) {
				if(a % i == 0 && b % i == 0){
					a = a / i;
					b = b / i;
					gcd = gcd * i;
					lcm = lcm * i;
				} else if(a % i == 0) {
					a = a / i;
					lcm = lcm * i;
				} else if(b % i == 0) {
					b = b / i;
					lcm = lcm * i;
				}
			}
		}
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

int gcd(int a, int b)
{
	unsigned int c;

	while (a%b)
	{

		c = b;
		b = a%b;
		a = c;
	}
	return b;
}

int lcm(int a, int b)
{
	unsigned int c;
	if (a < b)
	{
		c = a;
		a = b;
		b = c;
	}

	for (int i = 1; i <= b; i++)
	{
		if (!(a*i%b))
			return a*i;
	}
}
int main()
{
	unsigned int a, b;
	while (scanf("%lld%lld", &a, &b))
	{
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
	return 0;
}

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

int main(void){
  int i,a,b,temp,r,lcm;

  while(cin >> a >> b){
    if(a<b){
      temp=a;
      a=b;
      b=temp;
    }

    int x=a,y=b;

    while(b>0){
      r=a%b;
      a=b;
      b=r;
    }

    lcm=x*(y/a);
    printf("%d %d\n",a,lcm);
  }

  return 0;
}

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

int main() {
	long long a,b,e,f,l;
	while(cin>>a>>b){
		e=a;
		f=b;
		while(1){
		if(e>f){
			e=e%f;
		}
	    if(f>e){
	    	f=f%e;
	    }
	    if(f==e){
	    	l=e;
	    	cout<<l<<" "<<(a*b)/l<<endl;
	    	break;
	    }
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

constexpr ll NOT_SPECIFIED_VALUE_MIN = INT64_MIN;
constexpr ll NOT_SPECIFIED_VALUE_MAX = INT64_MAX;

template <typename T>
T gcd(T a, T b) {
	if (a < b) gcd(b, a);
	T r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}

template <typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

int main() {
	ll a, b;
	a = b = -1;
	while (true) {
		cin >> a >> b;
		if (a == -1) { break; }
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
		a = b = -1;
	}
}

C++: #include <iostream>

using namespace std;

long long gcd(long long a, long long b);
long long lcm(long long a, long long b);

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

long long gcd(long long a, long long b)
{
    long long r;

    while ((r = a % b) != 0) {
        a = b;
        b = r;
    }

    return b;
}

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

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

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


int main() {
    ios::sync_with_stdio(false);
    int a, b, g, l;
    while(cin >> a >> b){
      g = gcd(a, b);
      l = a*b/g;
      cout << g << " " << l << endl;
    }
    return 0;
}

C++: #include<cstdio>

int main(){
	long long a,b,g,l,t;
	while(scanf("%d %d", &a, &b) + 1){
		if(a > b){
			t = a;
			a = b;
			b = t;
		}
		if(b % a){
			t = a / 2;
			for(int i = t; i > 0; i--){
				if(!(a % i)){
					if(!(b % i)){
						g = i;
						i -= t;
						printf("%lld %lld\n", g, a * b / g);
					}
				}
			}
		}else{
			printf("%lld %lld\n", a, b);
		}
	}
	return 0;
}

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

using namespace std;

int gcd(int,int);

int main()
{
	int a,b,GCD,LCM;

	while(scanf("%d %d",&a,&b) != EOF)
	{
		GCD = gcd(a,b);

		LCM = (a*b) / GCD;

		printf("%d\n%d\n",GCD,LCM);
	}

	return 0;
}

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

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

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