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 "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();}}
ull gcd(ull a, ull b){while(true){ull k = a % b;if(k == 0)return b;a = b;b = k;}}
ull comb(ull n, ull m){ull p=1;m=min(m,n-m);for(ull i=1;i<=m;i++){p*=n-i+1;p/=i;}return p;}

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

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

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

int main(){
	int a , b ;
	while(cin>>a>>b){
		printf("%d %d\n" , gcd(a,b) , (a/gcd(a, b)*b));
	}
	return 0;
}

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

long GCD(long m,long n){
	long remain;
	if((remain = m % n) == 0)return n;
	else return GCD(n,remain);
}

int main(){
	long a,b;
	while(cin >> a >> b){
		cout << GCD(a, b) << " " << a * b / GCD(a, 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(){
  int a,b;
  
  while(cin>>a>>b){

  
    int ans1 = gcd(a,b);
    cout<<ans1<<" "<<a/ans1*b<<endl;
  }
  return 0;
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int i;
int js(long long x,long long y)
{
    for(i=1; ;i++)
    {
        if(i%x==0&&i%y==0)
        {
            break;
        }
    }
    return i;
}
main()
{
    long long n,k,j,max,min,x,y,t;
    while(~scanf("%lld %lld",&x,&y))
    {
        max=js(x,y);
        if(x>y)
            {
                t=x;
                x=y;
                y=t;
            }
        while(x!=0)
        {
            t=x;
            x=y%x;
            y=t;

        }
        min=y;
    printf("%lld %lld\n",min,max);
    }

}

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

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 x, int y);
int lcm(int x, int y);
int main()
{
	int x, y;
	while (cin >> x >> y){
		cout << gcd(x, y) << " " << lcm(x, y) << endl;
	}

	return 0;
}

int gcd(int x, int y)
{
	int r;


	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}


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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int gcd(int a,int b){
	if(b>a)	swap(a,b);
	while(a%b!=0){
		int tmp=a%b;
		a=b;	b=tmp;
	}
	return b;
}
int main(){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		int g=gcd(a,b);
		cout<<g<<" "<<a/g*b<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
int d(int n,int m)
{
    int t;
    while(m!=0)
    {
        if(n<m) {t=n;n=m;m=t;}
        t=m;
        m=n%m;
        n=t;
    }
    return n;
}
int main()
{
    int t,n,m;
    while( scanf("%d %d",&n,&m))
    {
        t=d(n,m);
        long long l=n/t*m;
        cout<<k<<" "<<l<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
int gcd(int a,int b){
	if(b==0) return a;
	return gcd(b,a%b);
}

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

int main(){
	int x,y;
	while(cin>>x>>y){
		cout<<gcd(x,y)<<' '<<lcm(x,y)<<endl;
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[50] = {};
	int b[50] = {};
	int g[50] = {};
	int l[50] = {};
	int i = 0;
	while (cin >> a[i] >> b[i]) {
		i++;
	}
	for (int j = 0; j < i; j++) {
		int n, m,aa,bb;
		aa = a[j];
		bb = b[j];
		while (a[j] != b[j]) {

			m = max(a[j], b[j]);
			n =	max(a[j], b[j])  % min(a[j], b[j]);
			a[j] = m;
			b[j] = n;
			
		}
		g[j] = a[j];
		aa = aa / g[j];
		bb = bb / g[j];
		l[j] = aa * bb * g[j];
		
	}
	for (int k = 0; k < i; k++) {
		cout << g[k] << l[k] << endl;
	}
	return 0;
}

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

int gcd(int a , int b){
	if (a<b) {
		a^=b;
		b^=a;
		a^=b;
	}
	return a%b ? gcd(a , a%b) : b;
}

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

int main(){
	int a , b ;
	while(cin>>a>>b){
		printf("%d %d\n" , gcd(a,b) , lcm(a , b));
	}
	return 0;
}

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

int main(){
	int a,b,c;
	int ansG,ansL1,ansL2;
	while(cin>>a>>b){
		ansL1=a;ansL2=b;
		if(a<b){
			int hoge=a;
			a=b;
			b=hoge;
		}
		while(true){
			if(a%b==0){
				ansG=b;
				break;
			}
			else{
				c=a%b;
				a=b;
				b=c;
			}
		}
		ansL1=ansL1/ansG;
		ansL2=ansL2/ansG;
		cout<<ansG<<" "<<ansG*ansL1*ansL2<<endl;
	}
	return 0;
}

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

int main() {
    int a, b;
    while (cin >> a >> b) {
        if (a > b) swap(a, b);
        int A = a, B = b;
        while ((a % A != 0) && (b % A != 0)) {
            --A;
        }
        while ((B % a != 0) && (B % b != 0)) {
            B += A;
        }
        cout << A << B << endl;
    }
    
    return 0;
}

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

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

int main(void){
  long long int a,b;
  while(cin>>a>>b){
    long long int ma = max(a,b);
    long long int mi = min(a,b);
    cout<<gcd(ma,mi)<<" "<<lcm(ma,mi)<<endl;
  }
}