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\n", G, L)
	}
}

C++: #include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b)
{
    if (!b) return a;
    else return gcd(b,a%b);
}

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

C++: #include"iostream"
#include"iomanip"
#include"string"

using namespace std;

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

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

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

long long gcd(long long m, long long n){

	if(m<n){
		long long swap;
		swap = m;
		m = n;
		n = swap;
	}

	do {
		if(n==0){
			return m;
		}
		
		int swap = m % n;
		m = n;
		n = swap;
	} while(1);
}


int main(){
//	m*n = LCM * GCD
	long long m, n;
	while(cin >> m >> n){
		long long  LCM, GCD;
		
		GCD = gcd(m, n);
		LCM = (m*n)/GCD;
		cout << GCD << " " << LCM << endl;
	}

	return 0;
}

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

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

int main()
{
    long long a;
    long long b;
    while(scanf("%I64d%I64d",&a,&b)!=EOF)
    {
        printf("%I64d %I64d\n",gcd(a,b),a/gcd(a,b)*b);
    }
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
int gcd(int x,int y)
{
	if(y==0)return x;
	return gcd(y,x%y);
}
int main()
{
    int a,b;
	while(cin >> a >> b){
		int z=gcd(a,b);
        int w=a/z*b;
		printf("%d %d\n",z,w);
	}
    return 0;
}

C++: // GCDandLCM.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;

double eucAlg(int a,int b);


int main(int argc, char* argv[])
{
	double a,b;	//??\??????
	double c, d;	//??????

	while(cin >> a >> b){

		c = eucAlg(a, b);

		d = a * b / c;
		cout << fixed << setprecision(0) << c << " " << d << endl;
	}
	return 0;
}

//??????????????????????????????
double eucAlg(
	int a,
	int b
	)
{
	double c;

	do
	{
		c = a % b;
		if(c == 0){
			break;
		}
		a = b;
		b = c;

	}while(1);

	return b;
}

C++: #include <iostream>
 
using namespace std;
 
int main(){
 
    unsigned long long a,b,c,d;
 
    while(cin>>a>>b){
        c=a;
        d=b;
        while(1){
            if(c>d)c=c-d;
            if(c<d)d=d-c;
            if(c==d){
                cout<<c<<" "<<a*b/c<<endl;
                ;break;}
        }}
         
 
 
return 0;
}

C++: #include <stdio.h>

template <typename T>
T gcd(T a, T b){
	T r;
	while(b > 0){
		r = a % b;
		a = b;
		b = r;
	}
	return a;
}
template <typename T>
inline T lcm(T a, T b){
	return a / gcd(a, b) * b;
}

int main(){
	int a,b,n,m;
	
	while( scanf("%d %d", &a, &b) != EOF){
		n = gcd(a,b);
		m = lcm(a,b);
		printf("%d %d\n", n , m);
	}

	return 0;
}

C++: 




#define INF 1000000;
#define RE(i,n)  for(i=0;i<n;i++)
inline int max(int n1 = - 1000000 , int n2 = -1000000, int n3 = -1000000)
{
return n1 > n2 ? (n1 > n3 ? n1 : n3) : (n2 > n3 ? n2 : n3);
}
inline int min(int n1 = 1000000, int n2 = 1000000, int n3 = 1000000)
{
return n1 < n2 ? (n1 < n3 ? n1 : n3) : (n2 < n3 ? n2 : n3);
}
#include<iostream>
#include<time.h>
using namespace std;



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

}


//#define LOCAL
int main()
{
#ifdef LOCAL

	freopen("C:\\Users\\VULCAN\\Desktop\\data.in", "r", stdin);
	//	freopen("C:\\Users\\VULCAN\\Desktop\\data.out", "w", stdout);
#endif
//这是一条帅气的分界线，写程序从这里开始吧
	int a, b;
	while (cin >> a >> b)
	{
		
		int ans = gcd(max(a,b), min(a,b));
		cout << ans <<" "<< a  / ans*b << endl;
	}

//这是一条可爱的分界线
#ifdef LOCAL
printf("用时%.3f秒\n", (double)clock() / CLOCKS_PER_SEC);
#endif
return 0;
}

C++: #include<cstdio>

int gcd_euclidean(int u, int v){
    if(v==0)  return u;
    return gcd_euclidean(v, u%v);
}

int lcm(int u, int v){
    return u*(v/gcd_euclidean(u,v));
}

int main(int argc, char const *argv[])
{
    int a, b;
    while(~scanf("%d %d", &a, &b)){
        printf("%d %d\n", gcd_euclidean(a,b), lcm(a,b));
    }
    return 0;
}

C++: #include<cstdio>
int main()
{
    long long a,b,c;
    while(~scanf("%lld%lld",&a,&b))
    {
        long long x=a,y=b;
        c=a%b;
        while(c)
        {
            a=b;
            b=c;
            c=a%b;
        }
        printf("%lld %lld\n",b,x*y/b);
    }
    return 0;
}

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

int main(){
	long long unsigned int a, b, r, gcd, lcm, x, y;

	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r = x % y){
			x = y;
			y = r;
		}
		gcd = y;
		lcm = a * b / gcd;

		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <math.h>

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b);
printf("%d %d\n",lcm, gcd);
    //std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0){return i;}
      else{i++;}
    }else{
      i++;
    }
  }
}

C++: #include <stdio.h>
#include <iostream>
#include <math.h>

int u(int a, int b);
long l(int a, int b, int gcd);

int main(){
  int a, b;
  int gcd;
  long lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b, gcd);
    std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(1){
    if(a==0) return b;
    if(b==0) return a;
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
}

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

C++: #include <iostream>
#include <vector>
#include <algorithm>


const int GCM(const int a,const int b){
	int x(a),y(b);
	while(x%=y){
		std::swap(x,y);
	}
	return y;
}

const int LCM(const int a,const int b){
	int x(a),y(b);
	while(x%=y){
		std::swap(x,y);
	}
	int tmp(a/y);
	tmp*=b;
	return tmp;
}


int main(int,char**){
	int a,b;
	while(std::cin >>a){
		std::cin >> b;
		std::cout << GCM(a,b) << ' ' << LCM(a,b)<<std::endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const int INF = 0x3fffffff;

int x, y;

int gcd(int x, int y) { if(!y) return x; else return gcd(y, x%y); }

int main()
{
	while(scanf("%d%d",&x,&y) != EOF)
	{
		int ans = gcd(x, y);
		cout<<ans<<" "<<(ll)x*y/ans<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
bool aaa;
int as,c;
float asd;
int a,b,gcd,lcm;
while(cin>>a>>b){
c=1;
gcd=1;
aaa=true;
while(aaa){
c++;
as=a/c;
asd=a/c;
if(as==asd){
as=b/c;
asd=b/c;
if(as==asd){
gcd*=c;
a/=c;
b/=c;
}
}
if(a==1||b==1){aaa=false;}
}
lcm=a*b/gcd;
cout<<gcd<<" "<<lcm<<endl;
}
}