Go: package main

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

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

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

using namespace std;

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

int main(){
        long long a, b;
        while (cin >> a >> b){
                if (a < b) swap(b, a);
                long g = gcd(a, b);
                cout << g << " " << a * b / g << endl;
        }
        return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
  int a,b,c,max=0,min=0,bet,les,ch1,ch2;
  vector<int> ayaku;
  vector<int> byaku;
  while(cin>>a>>b){
    for(int i=1;i<=(a/2);i++){
      if(a%i==0)
	ayaku.push_back(i);
    }
    for(int j=1;j<=(b/2);j++){
      if(b%j==0)
	byaku.push_back(j);
    }
    for(int i=0;i<ayaku.size();i++){
      for(int j=0;j<byaku.size();j++){
	if(ayaku[i]==byaku[j]&&max<byaku[j])
	  max=byaku[j];
      }
    }//?????§??¬?´???°??????
    min=(a/max)*b;
    cout<<max<<" "<<min<<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", b, a1 / b * b1);
	}
	return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int main(){
    ll a,b;
    while(cin>>a>>b)
        cout<<gcd(a,b)<<' '<<lcm(a,b)<<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",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;
}