Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

C++: #include <bits/stdc++.h>
#include<math.h>
using  namespace std;
#define ll    long long int
#define pai     pair<int,int>
#define vi      vector<int>
#define vd      vector<double>
#define mpi     map<int,int>
#define mps     map<string,int>
#define sti     stack<int>
#define stc     stack<char>
#define sei     set<int>
#define ses     set<string>
#define multii  multiset<int>

ll gcd(ll a,ll b){
if(b==0){
    return a;
}
else{
   return gcd(b,a%b);
}
}
 int main()
{
  /*#ifndef ONLINE_JUDGE
  freopen("tin.txt","r",stdin);
  freopen("tout.txt","w",stdout);
  #endif*/

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

cout<<gcd(a,b)<<" "<<(a*b)/gcd(a,b)<<endl;


}
}

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

unsigned int gcd(const unsigned int a, const unsigned int b) {
	unsigned int result = 1;

	for (unsigned int k = 1; k <= a and k <= b; k++) {
		if (a % k == 0 and b % k == 0) { result = k; }
	}

	return result;
}

unsigned int lcm(unsigned int a, unsigned int b) {
	unsigned int mult;

	if (a > b) {
		unsigned int tmp = a;
		a = b;
		b = tmp;
	}

	for (unsigned int k = 1; k <= a; k++) {
		mult = b * k;
		if (mult % a == 0) { return mult; }
	}

	return 0;
}

int main() {
	unsigned int a, b;
	
	while (!std::cin.eof()) {
		std::cin >> a >> b;
		std::cout << gcd(a, b) << " " << lcm(a, b) << std::endl;
	}
}

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

unsigned long long int GCD();

int main(void){
	while(1){
		unsigned long long int a, b, gcd, lcm, temp;
		if( a < b){
			temp = a;
			a = b;
			b = temp;
		}
		cin >> a >> b;
		if(a == 0 || b == 0)
			return 0;
		gcd = GCD(a,b);
		lcm = a * b / gcd;
		cout << gcd << ' ' << lcm << endl;
	}
	return 0;
}

unsigned long long int GCD(unsinged long long int a, b){
	if(a % b == 0)
		return (b);
	else
		return (GCD(b, a%b);
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <functional>
#include <iomanip>
using namespace std;

#define ll long long int

#define rep(p,q) for(int i = p; i < q;i++)

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

//5
int main(void) {
	ll a, b;
	while (cin >> a >> b) {
		ll g = gcd(a, b);
		ll l = a * b / g;
		cout << g << " " << l << endl;
	}
}

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

using namespace std;


int main(){

	long int a, b;
	long int f;
	long int G, L, temp;

	while(cin >> a){
		cin >> b;
		f = a * b;
		if(a < b){
			temp = a;
			a = b;
			b = temp;
		}
		while(1){
			temp = a % b;
			if(temp==0) break;
			a = b;
			b = temp;
		}
		G = b;
		L = f/G;

		cout << G << ' ' << L << endl;
	}
	return 0;
}

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

int main() {
	int a,b,c,e,f;
	while(cin>>a>>b){
		int g=0,l=0;
		e=a;
		f=b;
		if(e>f){
			e=e-f;
		}
	    if(f>e){
	    	f=f-e;
	    }
	    if(f==e){
	    	l=e;
	    }
	    if(l!=0)break;
		cout<<l<<" "<<a*b/l<<endl;
	    }
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    long long i,a,b,c,d,e;
    while(cin>>a>>b){
        if(a<b){
            i=b-a;
        }
        else{
            i=a-b;
        }
    for( long long j=i;j>0;i--){
        if(a%i==0 && b%i==0){
            c=i;
            break;
        }
    }
    e=a*b/c;
        
    cout<<c<<" "<<e<<endl;
    }
    return 0;
}

C++: #include <iostream>

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

int main(void) {
    int a;
    int b;
    int g;
    while (std::cin >> a >> b) {
       g = gcd(a, b); 
       std::cout << g << std::endl; 
       std::cout << (a / g) * b << std::endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
ll gcd(ll a,ll b){
    if(b == 0)
        return a;
    return gcd(b,a % b);
}
int main(){
    ll a,b;
    while(scanf("%lld%lld",&a,&b) != EOF){
        printf("%lld %lld\n",gcd(a,b),a * b / gcd(a,b));
    }
    return 0;
}

C++: #include <cstdio>
int gcd (int a, int b) {
	while (true) {
		if (a > b)
			a -= b;
		else if (a < b)
			b -= a;
		else
			break;
	}
	return a;
}
int lcm (int a, int b) {
	int sum_a = a;
	int sum_b = b;
	while (true) {
		if (sum_a > sum_b)
			sum_b += b;
		else if (sum_a < sum_b)
			sum_a += a;
		else
			break;
	}
	return sum_a;
}
int main ( int argc, char *argv[] ) {
	using namespace std;
	int a, b;
	while (EOF != fscanf(stdin, "%d %d\n", &a, &b)) {
		printf("%d %d\n", gcd(a, b), lcm(a, b));
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

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

C++: #include<iostream>
using namespace std;
int gcd(long long ,long long);
int main(){
  long long a,b,c,d;
  cin>>a>>b;
  d=gcd(a,b);
  c=a*(b/d);
  cout<<d<<' '<<c<<endl;
  return 0;
}

int gcd(long long x,long long y){
  while(x!=y){
    if(x>y){
      x=x%y;
      if(x==0) return y;
    }
    else{
      y=y%x;
      if(y==0) return x;
    }
  }
  return x;
}

C++: #include<iostream>

using namespace std;

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

C++: 
#include <stdio.h>

int main()
{
	long int a,b,a1,b1;
	long int r;
	while(scanf("%ld %ld",&a1,&b1) != EOF){
		a = a1;
		b = b1;
		if(a < b){
			r = b;
			b = a;
			a = r;
		}
		if(a <= 0 || b <= 0){
			return 0;
		}
		r = a % b;
		while(r != 0){
			a = b;
			b = r;
			r = a % b;
		}
		printf("%ld %ld\n", b, a1 / b * b1);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
int a,b,gcd,lcm,tmp,r,num_a,num_b;
while(cin>>num_a>>num_b){
a=num_a,b=num_b;
if(a<b){
tmp = a;
a = b;
b = tmp;
}
r=a%b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
gcd = b;
lcm = (num_a*num_b)/gcd;
cout<<gcd<<" "<<lcm<<endl;
}
return 0;
}