Go: package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

func gcd(x, y int) int {
	if x < y {
		gcd(y, x)
	}
	for 0 < y {
		r := x % y
		x, y = y, r
	}
	return x
}

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

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = min(temp_a, temp_b);
		lcm = (a / gcd) * b;
		cout << gcd << " "<< lcm << endl;

	}

	//getchar();

	return 0;
}

C++: #include<stdio.h>
int main(){int a,b;while(scanf("%d%d",&a,&b))printf("%d %d\n",__gcd(a,b),__gcd(a,b)*b);return 0;}

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

#define MAX 256

int main(void){
	
	long max[50], min[50];
	for (long i = 0; i < 50; i++){
		max[i] = 0;
		min[i] = 0;
	}

	long a, b;
	long i = 0;

	while (scanf("%d%d", a, b) != EOF){
		while (max[i] == 0){
			for (long j = a; j > 0; j--){
				if (a%j == 0 && b%j == 0)max[i] = j;
			}
		}
		long j = 1;
		while (min[i] == 0){
			if ((a*j) % b == 0)min[i] = a*j;
			j++;
		}
		i++;
	}

	for (long j = 0; j < i; j++){
		printf("%d %d\n", max[j], min[j]);
	}

	return 0;
}

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

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

long lcm(long m, long n) {
    if(m == 0 || n == 0) return(0);
    return((m * n) / gcd(m, n));
}

int main(void) {
    long a, b;
    while(scanf("%ld %ld", &a, &b) != EOF) {
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
    return(0);
}

C++: #include <stdio.h>
int gcd(__int64 a,__int64 b){
	return b==0?a:gcd(b,a%b);
}
__int64 a,b;
int main()
{
	while(scanf("%ld%ld",&a,&b) != EOF){
		printf("%ld\n%ld\n",gcd(a,b),a * b / gcd(a,b));
	}
	return 0;
}

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

int gcd(int a, int b) {

    int x, r;        
    if(b > a){
        x = a;
        a = b;
        b = x;
    }

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

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 <cstdio>
#include <iostream>

using namespace std;

int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd

int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm

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,tmp;
  while(cin >> a >> b){
    int tmp_a = a;
    int tmp_b = b;
    for(;;){
      if(b%a==0) break;
      tmp = a;
      a = b % a;
      b = tmp;
    }
    int GCD = a;
    int LCM = (tmp_b / a)*tmp_a;
    cout << GCD << " " << LCM<< endl;
  }
}

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

using namespace std;

int main() {
    int a,b,a2,b2;
    int lcm,gcd;
    while(cin >> a >> b){
        a2=a;
        b2=b;
        while(a != b){
        if(a>b){a = a-b;}
        else{b=b-a;}
        }
        lcm = a;
        gcd=a2 / lcm * b2;
        cout << lcm << " " << gcd << endl;
    }

}

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

int GCD(int max, int min){
    if(max % min == 0) { return min; }
    else return GCD(min, max % min);
}
 
int main(){
    long long int a, b;
    while(cin >> a >> b){
        long long int gcd = GCD(max(a, b), min(a, b));
        long long int lcm = a * b / gcd;
        cout << GCD(max(a, b), min(a, b)) << " " << lcm << endl;
    }
    return 0;
}

C++: def gcd(a,b)
      if b==0
            a
      else
            gcd(b,a%b)
end
def lcm(a,b){a * b / gcd(a,b)}
while line = gets
      a,b = line.split.map(&:to_i)
      print gcd(a,b)," ",lcm(a,b),"\n"
end

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

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

int main(void){
    int n, m;
    while(cin >> n >> m){
        cout << gcd(n, m) << " " << lcm(n, m) << endl;
    }
}

int lcm(int a, int b){
    int sum_a = a;
    int sum_b = b;
    while(true){
        if(sum_a < sum_b){
            sum_a += a;
        } else if(sum_a > sum_b){
            sum_b += b;
        } else {
            return sum_a;
        }
    }
}

int gcd(int a, int b){
    int smaller = a < b ? a : b;
    int bigger = a > b ? a : b;
    int end_point = smaller / 2;
    int counter = 0;
    int answer = 0;
    while(counter <= end_point){
        counter++;
        if(a % counter == 0 && b % counter == 0){
            answer = counter;
        }
    }
    return answer;
}

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

long long a,b;

long long gcd(long long x,long long y){
  if(b == 0) 
    return x;
  else 
    return gcd(y, x % y);
}
long long lcm(long long x,long long y){
    return (x * y) / gcd(x, y);
}

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

C++: #include <iostream>

using namespace std;

int GCD(const int& a, const int& b) {
	int g_a = a;
	int g_b = b;
	if (a == 0 || b == 0)
		return 0;
	while (a != b)
	{
		if (a > b) 
			g_a -= g_b;
		else 
			g_b -= g_a;
	}
	return g_a;
}

int LCM(const int& a, const int& b) {
	int l_a = a;
	int l_b = b;
	if (a == 0 || b == 0)
		return 0;
	return ((l_a / GCD(l_a, l_b)) * l_b);
}

int main() {
	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 int a, b;
	long long int A, B;
	cin >> a >> b;
	long long int c = a;
	long long int d = b;
	if (a <= b)
	{
		while (a != 0)
		{
			long long int r = b%a;
			b = a;
			a = r;
		}
		A = b;
	}
	if (a > b)
	{
		while (b != 0)
		{
			long long int r = a%b;
			a = b;
			b = r;
		}
		A = a;
	}
	B = c*d / A;
	cout << A << " " << B << endl;
	return 0;
}

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

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

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

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

int main(){
  long long a,b;

  if(a<b) swap(a,b); 
  
  while(cin>>a>>b){
    long long g = gcd(a,b);
    cout<<g<<" "<<lcm(a,b,g)<<endl;
  }

  return EXIT_SUCCESS;
}