Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

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

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

int main(){

	int a, b;

	while(std::cin >> a >> b){

		long int minmul = a * b; //least common multiple
		int maxdivi = 1; //greatest common divisor

		if(a == 0 || b == 0){
			std::cout << 0 << " " << 0 << std::endl;

		}else{					//Euclidean Algorithm

			if(b > a)
				std::swap(a, b);

			while(a % b != 0){
				a = a % b;
				if(b > a)
					std::swap(a, b);
			}
		
		maxdivi = b;
		minmul = minmul / maxdivi;

		std::cout << maxdivi << " " << minmul << std::endl;
		}
	}

	return 0;
}

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

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

int gcd(int a, int b){

int p,q,r;

if(a<b){p=b;b=a;a=p;

}

while((r=b%a)!=0){
   q=b/a;
   b=a;
   a=r;
}
   
   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;
}