Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stdio.h>
using namespace std;

long long LCM(long long c,long long d){
	long long res=d;
	if(c%d!=0)res=LCM(d,c%d);
	return res;
}
int main() {
    clock_t cTimeStart, cTimeEnd;
    cTimeStart = clock();           // 現在時刻
    long long a,b;
    long long lcm;
    while(cin>>a>>b){
    	lcm =LCM(a,b);
       	cout << lcm<<" "<<(a*b/lcm)<<endl;;
    }

    cTimeEnd = clock();           // 現在時刻
//    cout<< "処理時間:" <<(cTimeEnd - cTimeStart)/1000 << "[ms]" << endl;

	return 0;
}

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

int main() {
	int a,b,e,f;
	while(cin>>a>>b){
		int l;
		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>
using namespace std;

int main(){
int n,m,a,b,i,N,M;
while(cin>>n>>m){
a=1;
for(i=2;;i++){
N=n%i;
M=m%i;
if(N==0&&M==0){n/=i; m/=i; a*=i; i--;}
if(n<i||m<i)break;}
b=n*m*a;
cout<<a<<" "<<b<<endl;}}

C++: #include<cstdio>
long long gcd(long long a,long long b)
{
    
    return b==0?a:gcd(b,a%b);
}
int main()
{
    long long a,b;
    while (scanf("%lld%lld",&a,&b)==2)
    {
    	long long sum=gcd(a,b);
    	long long num=a/sum*b;
    	printf("%lld %lld\n",sum,num);
	}
    return 0;
}

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

using namespace std;

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

int main(){
  vector<long> a,b;
  long c,d;
  while(cin >> c >> d){
    a.push_back(c);
    b.push_back(d);
  }
  
  for(int i=0; i<a.size(); i++){
    cout << gcd(a[i],b[i]) << " " << lcm(a[i],b[i]) << endl;
  }

  return 0;
}

long gcd(long a, long b){
  long tmp;
  while(a%b != 0){
    tmp = a;
    a = b;
    b = tmp%b;
  }
  return b;
}

long lcm(long a, long b){
  long c=a,d=b;
  while(a != b){
    if(a > b){
      b+=d;
    }else{
      a+=c;
    }
  }
  return a;
}

C++: #include <stdio.h>

int main(void) {
	int buf,i,c;
	long int a,b,gcd = 1, lcm;
	
	while(scanf("%ld%ld",&a,&b) != EOF){
		if(b > a){buf = a;a = b;b = buf;}
		for(i = 2; a/2 > i;i++){
			if(b%(a/i) == 0) {gcd = a/i;break;}
		}
		for(i = 1; ;i++){
			if((a*i)%b == 0) {lcm = a*i;break;}
		}
		printf("%d %d\n",gcd, lcm);
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
ll gcd(ll m, ll n){
      while(m!=n){
  		if (m>n) m = m - n;
  		else n = n - m;
  	}
  	return m;
}
ll lcm(ll m,ll n){
      return ((m/gcd(m, n))*n);
}
int main(){
      ll a,b;
      while(cin>>a>>b){
            cout<<gcd(a,b)<<' '<<lcm(a,b)<<endl;
      }
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
ll a,b;
ll gcd(ll m,ll n)
{
    if(m==0)return n;
    if(n==0)return m;
    return gcd(n,m%n);
}
int main()
{
    while(~scanf("%lld%lld",&a,&b))
    {
        ll ans1=gcd(a,b);
        ll ans2=a*b/ans1;
        printf("%lld %lld\n",ans1,ans2);
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
long long gcd(long long a,long long b)
{
	return b?gcd(b,a%b):a;
}
int main()
{
	long long a,b;
	while(scanf("%I64d%I64d",&a,&b)!=EOF)
	{
		printf("%I64d %I64d\n",gcd(a,b),a/gcd(a,b)*b);
	}
	return 0;
}

C++: #include <stdio.h>

#include <algorithm>

using namespace std;

int getGcd(int a, int b) {
  if (a < b) {
    swap(a, b);
  }
  int rem = a % b;
  while (rem != 0) {
    a = b;
    b = rem;
    rem = a % b;
  }
  return b;
}

int main() {
  //freopen("GcdAndLcm.in", "r", stdin);
  int a, b;
  while (scanf("%d%d", &a, &b) == 2) {
    int gcd = getGcd(a, b);
    int lcm = (long long)a * b / gcd;
    printf("%d %d\n", gcd, lcm);
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

typedef long long ll;

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

ll lcm(int a,int b){
	//int table[2][100000];
	//for(int i = 0; i < 2; i++)
	//	fill(table[i],table[i]+100000,0);
	//// 1ÍÇ¿çÌà1Â¾¯Â
	//table[0][1] = 1;
	//table[1][1] = 1;

	//int t_a=a;
	//for(int i = 2; i*i <= t_a; i++){
	//	while(t_a % i == 0){
	//		table[0][i]++;
	//		t_a/=i;
	//	}
	//}
	//if(table[0][t_a] == 0)
	//	table[0][t_a]=1;

	//int t_b=b;
	//for(int i = 2; i*i <= t_b; i++){
	//	while(t_b % i == 0){
	//		table[1][i]++;
	//		t_b/=i;
	//	}
	//}
	//if(table[1][t_b] == 0)
	//	table[1][t_b]=1;

	//ll mul = 1;
	//for(int i = 2; i <= 100000; i++){
	//	if(table[0][i] == 0 && table[1][i] == 0)
	//		continue;
	//	else{
	//		int mc = max(table[0][i],table[1][i]);
	//		for(int j = 0; j < mc; j++)
	//			mul *= i;
	//	}
	//}

	ll mul = 1;
	mul = (b/gcd(a,b))*a;

	return mul;
}

int main(){

	ll a,b;
	while(1){
		cin >> a >> b;
		if(cin.eof()){
			break;
		}
		cout << gcd(a,b) << " " << lcm(a,b) << endl;
	}

	return 0;
}

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

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

long gcd(long a, long b) {

    if ( a < b ) {
        long t = b;
        b = a;
        a = t;
    }

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

}

int main() {

    long a, b;
    
    while (cin >> a >> b) {

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

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

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


int main(){
      ll a,b,c,d;
      while(cin >>a >>b){
            c = gcd(a,b);
            d = a*(b/c);
            cout << c <<' '<< d << endl;
      }
}

C++: #include <stdio.h>

int main(void)
{
	int a, b;
	int l, s;
	int gcd, lcm;
	
	while (scanf("%d %d", &a, &b) != EOF){
		l = a;
		s = b;
		
		if (l < s){
			l = b;
			s = a;
		}
		
		while (s){
			l %= s;
			l += s;
			s = l - s;
			l -= s;
		}
		
		gcd = l;
		lcm = a / gcd * b;
		
		printf("%d %d\n", gcd, lcm);
	}
	
	return (0);
}

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

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

int main()
{
    int min,max,a,b;
    while(scanf("%d %d",&a,&b)!=EOF)
    {
    max = gcd(a,b);
    min = (a/max)*(b/max)*max;
    cout << max << " " << min<<endl;
    }
    return 0;
}

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

long long a, b, g;

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

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

C++: #include <iostream>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <sstream>
using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long

int main()
{
	int a, b;
	while (cin >> a >> b)
	{
		if (a < b) swap(a, b);
		int A = a; int B = b;
		while (1)
		{
			a -= (a / b)*b;
			if (a == 0) break;
			swap(a, b);
		}
		cout << b << " " << A / b*B << endl;
	}
	return 0;
}