Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"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 <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",gcd, lcm);
    //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;
  int odd = 1;
  if(a%2==0) return 2;
  else i++;
  
  while(1){
    if(a%i==0){
      if(b%i==0){break;}
      else{i += 2;}
    }else{
      i += 2;
    }
  }
  return i;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define REP(i,N) for(int i = 0; i < (int)N; i++)

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

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

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

int main(){

	double x,y;
	double a,b,c;
	bool flag;

	while(cin>>x>>y){

		flag = true;

		a=max(x,y);
		b=min(x,y);

		while(flag){

			c=abs(a-b);
			a=b;b=c;
			if(a==b)flag=false;

		}

		printf("%d %d\n",static_cast<int>(a),static_cast<int>((x*y)/a));
//		cout<<setprecision(0)<<a<<" "<<(x*y)/a;

	}

	return 0;
}

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

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

int main(){
  int a, b;
  int gcd, 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==1) return b;
    else     return a;
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
}

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

C++: #include<iostream>

int gcd(int x,int y);
int lcm(int x,int y);

int main()
{
	int a,b;
	while(1){
		std::cin>>a>>b;
		if(std::cin.eof())break;
		std::cout<<gcd(a,b)<<' '<<lcm(a,b)<<std::endl;
	}
}

int gcd(int x,int y)
{
	int z;
	while(y!=0)
	{
		z=x%y;
		x=y;
		y=z;
	}
	return x;
}

int lcm(int x,int y)
{
	int g=gcd(x,y);
	return x/g*y;
}

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

C++: #include<stdio.h>
int main(){
	int a,b,j,x,y;
	while(scanf("%d%d",&a,&b)!=EOF){
		int i;
		if(a>b){i=a;a=b;b=i;}x=a;y=b;
		while(b-a){
			b=b-a;
			if(a>b){i=a;a=b;b=i;}}
		j=(x/b)*(y/b)*b;
		printf("%d %d\n",b,j);}
	return 0;}

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

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

 using namespace std;
 int gcd(int a, int b)
{
    
}



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

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


int gcd(int a,int b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int gcd2(int a,int b)
{
    while(b!=0)
    {
        int temp=a;
        a=b;
        b=temp%a;
    }
    return a;
}
typedef long long LL;
LL LCM(int a,int b)
{
    int multi=gcd(a,b);
    return (LL)a*(b/multi);
}
int main()
{
    int a,b;
    while(~scanf("%d%d",&a,&b))
    {
        cout<<gcd(a,b)<<" "<<LCM(a,b)<<endl;
    }
    return 0;
}

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


int main(){


    long long a,b,c=12,temp,p;
    while (scanf("%lld %lld",&a,&b)!=EOF)
    {
        c=12;

    if(a > b)
    {
        temp = a;
        a = b;
        b = temp;
    }
    p = a*b;
    while(c != 0)
    {
       c = a%b;
       a = b;
       b = c;
    }

    printf("%lld ",a);
    printf("%lld\n",p/a);
    }
    return 0;
}

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

using namespace std;

int main(){
    int a,b;
    while(cin>>a>>b){
        int temp_a = a;
        int temp_b = b;
        while(1){
            int l = max(temp_a,temp_b);
            int r = min(temp_a,temp_b);
            l = l-r;
            if(l==r){
                cout<<l<<" "<<a/l * b/l * l <<endl;
                break;
            }else{
                temp_a = l;
                temp_b = r;
            }
        }
    }
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int a, b;
	while( cin >> a >> b ){
		int gcd = 1, lcm;
		//cout << max(a,b) << endl;
		for( int i = 2; i < max(a,b); i++ ){
			if( a%i == 0 && b%i == 0 ){
				gcd = i;
			}
		}
		lcm = (a / gcd) * b;
		cout << gcd << ' ' << lcm << endl;
	}
}

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

C++: #include <iostream>

int GCD(int a, int b) {
	int c = std::max(a, b),
		d = std::min(a, b);
	while (c != d) {
		c -= d;

		int tmp[] = {c, d};
		c = std::max(tmp[0], tmp[1]);
		d = std::min(tmp[0], tmp[1]);
	}

	return c;
}

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

C++: #include<stdio.h>
 #include<math.h> 
int main(){ unsigned int a,b;
 while(~scanf("%u%u",&a,&b)){ 
unsigned int c=a,d=b; while(a>0&&b>0){
 if(a>b)a=a%b; 
else b=b%a; } 
printf("%u %u\n",a+b,c/(a+b)*d);
 }

 }

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


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



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;

}