Go: package main

import (
	"fmt"
)

func main() {
	var a, b int
	for {
		i, _ := fmt.Scan(&a, &b)
		if i == 0 {
			break
		}

		gcd := getGCD(a, b)
		fmt.Println(gcd, getLCM(a, b, gcd))
	}
}

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

func getLCM(a, b, gcd int) int {
	return a * b / gcd
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using comd = complex<double>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

template <typename T>
void out(deque < T > d)
{
  for(size_t i = 0; i < d.size(); i++)
  {
    debug(d[i]);
  }
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

ll gcd(ll a,ll b){
  if(a < b) swap(a,b);
  if(b == 0) return a;
  return gcd(b,a%b);
}

ll lcm(ll a,ll b){
  return a*b / gcd(a,b);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  while(cin >> a >> b) cout << gcd(a,b) << " " << lcm(a,b) << endl;
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	long long x , y , i , j , tmp , tmp2;
	while( cin >> x >> y ){
		long long n = x>y ? x:y;
		for( i=1 ; i<=n ; i++ ){
			if( x%i+y%i==0 )
				tmp = i ;
		}
		i=0;
		while(1){
			i++;
			if( i%x+i%y==0 ){
				tmp2=i;
				break;
			}
		}
		cout << tmp <<" "<< tmp2 << endl;
	}
}

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

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

long long lcm(long long a, long long b) {
    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 <stdio.h>
using namespace std;

int gcd(long num1,long num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(long num1,long num2) {
	return num1 / (double)gcd(num1, num2) * num2;
}

int main() {
	long a, b;
	while (~scanf("%d %d",&a,&b)) {
		if (b > a) {
			int tmp = b;
			b = a;
			a = tmp;
		}
		printf("%d %d\n", gcd(a, b),(long)lcm(a,b));
	}
}

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

using namespace std;

int main()
{
	unsigned long a, b, r, c, d;
	unsigned long ta, tb;
	int i = 0;


	while(cin>>a>>b) {
		
	if (a > b){
		ta = a;
		tb = b;
	} else {
		ta = b;
		tb = a;
	}
	

	while (1) {
	r = ta % tb;
	if (r == 0) break;
	ta = tb;
	tb = r;
	}
	c = tb;
	
	d = a * (b  / c);

	printf("%d %d\n", c, d);
	}

	

	return (0);
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
for(i=0;i<=50;++i){
  cin>>a>>b;
x=a;y=b;
while(1){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
  else if(x==y){break;}
}
L=(a*b)/x;
if(x==1){cout<<y<<" "<<y<<endl;}
else{cout<<y<<" "<<L<<endl;}
}
  return 0;
}

C++: // B.cpp

#include <iostream>
#include <cmath>
#include <string>

using namespace std;

int gcd(int, int);
int lcm(int, int);

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

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a < b){
		max = b, min = a;
	}
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
int lcm(int a, int b) {
	int max, min, res;
	res = 1;
	if(a > b){
		max = a, min = b;
	}
	if(a < b){
		max = b, min = a;
	}
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return a / max * b;
}

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

int gcd(int a,int b){
    int c;
    if(a<b){
        a+=b;
        b=a-b;
        a-=b;
    }
    while(b!=0){
        c=a%b;
        a=b;
        b=c;
    }
    return(a);
}

int main(){
    int data[2];
    int answer;
    while(cin>>data[0]>>data[1]){
        answer=gcd(data[0],data[1]);
        cout<<answer<<" "<<int(data[0]*data[1]/answer)<<endl;
    }
}

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

int main()
{
	long long a,b,m,n,d,i,k;
	int c=2;
	while(c--)
	{cin>>a>>b;
		if(a>b)
		{
			d=a;
			a=b;
			b=d;
		}
		for(i=a;i>1;i--)
		{
			if((b%i)==0&&(a%i)==0)
			break;
		}
		n=i;
		k=(a*b)/n;
		m=k;
		cout<<n<<" "<<m;
		cout<<endl;
	}
	return 0;
 }

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

int main(){
	long long int a,b,x,y,z;
	
	while(cin >> a >> b){
		x=max(a,b);
		y=min(a,b);
		while(1){
			if(y==0) break;
			z=x%y;
			x=y;
			y=z;
		}
		
		cout << x << ' ' << a*b/x << endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int x, int y);
int main(){
  int n,m;
  while(cin >>n>>m){
    int x = gcd(n,m);
    cout <<x<<" "<<(n/x)*m<<endl;
  }
  return 0;
}
int gcd(int x, int y){
  int r = x%y;
  if(r == 0) return y;
  else return gcd(y,r);
}

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

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

int main(void){
   int a, b, tmp;
   if (a < b){
       tmp = b;
b = a;
a = tmp;

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

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

int gcd(int x,int y);

int main(){
   while(true){
      int a,b;
      cin >> a >> b;
      if(cin.eof())
         break;
      int c=gcd(a,b);
      cout << a << ' ' << a/c*b << endl;
   }
   return 0;
}

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

C++: #include <iostream>
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 a,b;
  while(cin >> a >> b){
    if(a < b)swap(a,b);
    cout << gcd(a,b) << ' ' << lcm(a,b) << endl;
  }
  return 0;
}

C++: //最小公倍数と最大公約数を求める
#include<iostream>
#include<cstdio>
#include<algorithm>
unsigned long a,b;//aとbの最小公倍数と最大公約数を求める
unsigned long G,L;//最大公約数と最小公倍数
int GCD(int x,int y){
  int c;
  c = x%y;
  if(c ==0)
    return y;
  else{
    return (GCD(y,c));
 }
}

int main(){
  while(scanf("%lu %lu",&a,&b) != EOF){
    if(a >b)
     G = GCD(a,b);
    else if(a <b)
      G = GCD(b,a);
    else
      G = a;
    
    L = (a*b)/G;
  printf("%lu %lu\n",G,L);

  }
  return 0;
}

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

int main(){
    double a,b;

    while(cin>>a>>b){
        cout<<__gcd(a,b)<<" "<<a / __gcd(a,b) * b <<endl;
    }
    return 0;
}

C++: #include <cstdio>

int main()
{
    long a, b;
    long m, n, temp;

    while (scanf("%ld %ld", &a, &b) != EOF) {
        if (a < b) {
            temp = a;
            b = a;
            a = temp;
        }
        m = a;
        n = b;

        while (n != 0) {
            temp = n;
            n = m % n;
            m = temp;
        }

        printf("%ld %ld\n", m, a / m * b);
    }

    return 0;
}