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 <stdio.h>

template <typename T>
T gcd(T a, T b){
	T r;
	while(b > 0){
		r = a % b;
		a = b;
		b = r;
	}
	return a;
}
template <typename T>
inline T lcm(T a, T b){
	return a / gcd(a, b) * b;
}

int main(){
	int a,b,n,m;
	
	while( scanf("%d %d", &a, &b) != EOF){
		n = gcd(a,b);
		m = lcm(a,b);
		printf("%d %d\n", n , m);
	}

	return 0;
}

C++: 




#define INF 1000000;
#define RE(i,n)  for(i=0;i<n;i++)
inline int max(int n1 = - 1000000 , int n2 = -1000000, int n3 = -1000000)
{
return n1 > n2 ? (n1 > n3 ? n1 : n3) : (n2 > n3 ? n2 : n3);
}
inline int min(int n1 = 1000000, int n2 = 1000000, int n3 = 1000000)
{
return n1 < n2 ? (n1 < n3 ? n1 : n3) : (n2 < n3 ? n2 : n3);
}
#include<iostream>
#include<time.h>
using namespace std;



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

}


//#define LOCAL
int main()
{
#ifdef LOCAL

	freopen("C:\\Users\\VULCAN\\Desktop\\data.in", "r", stdin);
	//	freopen("C:\\Users\\VULCAN\\Desktop\\data.out", "w", stdout);
#endif
//这是一条帅气的分界线，写程序从这里开始吧
	int a, b;
	while (cin >> a >> b)
	{
		
		int ans = gcd(max(a,b), min(a,b));
		cout << ans <<" "<< a  / ans*b << endl;
	}

//这是一条可爱的分界线
#ifdef LOCAL
printf("用时%.3f秒\n", (double)clock() / CLOCKS_PER_SEC);
#endif
return 0;
}

C++: #include<cstdio>

int gcd_euclidean(int u, int v){
    if(v==0)  return u;
    return gcd_euclidean(v, u%v);
}

int lcm(int u, int v){
    return u*(v/gcd_euclidean(u,v));
}

int main(int argc, char const *argv[])
{
    int a, b;
    while(~scanf("%d %d", &a, &b)){
        printf("%d %d\n", gcd_euclidean(a,b), lcm(a,b));
    }
    return 0;
}

C++: #include<cstdio>
int main()
{
    long long a,b,c;
    while(~scanf("%lld%lld",&a,&b))
    {
        long long x=a,y=b;
        c=a%b;
        while(c)
        {
            a=b;
            b=c;
            c=a%b;
        }
        printf("%lld %lld\n",b,x*y/b);
    }
    return 0;
}

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

int main(){
	long long unsigned int a, b, r, gcd, lcm, x, y;

	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r = x % y){
			x = y;
			y = r;
		}
		gcd = y;
		lcm = a * b / gcd;

		cout << gcd << " " << lcm << 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",lcm, gcd);
    //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;
  
  while(1){
    if(a%i==0){
      if(b%i==0){return i;}
      else{i++;}
    }else{
      i++;
    }
  }
}

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

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

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

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

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


const int GCM(const int a,const int b){
	int x(a),y(b);
	while(x%=y){
		std::swap(x,y);
	}
	return y;
}

const int LCM(const int a,const int b){
	int x(a),y(b);
	while(x%=y){
		std::swap(x,y);
	}
	int tmp(a/y);
	tmp*=b;
	return tmp;
}


int main(int,char**){
	int a,b;
	while(std::cin >>a){
		std::cin >> b;
		std::cout << GCM(a,b) << ' ' << LCM(a,b)<<std::endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const int INF = 0x3fffffff;

int x, y;

int gcd(int x, int y) { if(!y) return x; else return gcd(y, x%y); }

int main()
{
	while(scanf("%d%d",&x,&y) != EOF)
	{
		int ans = gcd(x, y);
		cout<<ans<<" "<<(ll)x*y/ans<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
bool aaa;
int as,c;
float asd;
int a,b,gcd,lcm;
while(cin>>a>>b){
c=1;
gcd=1;
aaa=true;
while(aaa){
c++;
as=a/c;
asd=a/c;
if(as==asd){
as=b/c;
asd=b/c;
if(as==asd){
gcd*=c;
a/=c;
b/=c;
}
}
if(a==1||b==1){aaa=false;}
}
lcm=a*b/gcd;
cout<<gcd<<" "<<lcm<<endl;
}
}

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

using namespace std;

/*Assumption:a > b*/
int gcd(int a, int b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

/*c is gcd.*/
int lcm(int a, int b, int c) {
  return (a / c) * b;
}

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

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

using namespace std;

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

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

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

typedef unsigned long int uint;

uint func1(uint a,uint b){
    while(a != b){
        if(a>b)a-=b;
        else b-=a;
    }
    return a;
}

uint func2(const uint a,const uint b){
    uint a2=a,b2=b;
    while(a2 != b2){
        if(a2>b2)b2+=b;
        else a2+=a;
    }
    return a2;
}

int main(){
    uint a,b;
    cin >> a >> b;

    cout << func1(a,b) << " " << func2(a,b);

    return 0;
}

C++: #include <iostream>
#include <cstdio> 
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

#ifndef typeof
#define typeof __typeof__
#endif // typeof
 
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(typeof((c).rbegin()) i = (c).rbegin(); i != (c).rend(); i++)
#define repby(i, a, b, step) for(typeof(b) i = (a); i < (b); i += (step))
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

int gcd(int a, int b) {
  if (a < b)
    return gcd(b, a);

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

int main(int argc, char **argv)
{
  int a, b;

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

  return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)

#define int long long 
using namespace std;
signed main(){
 int a,b;
 while(cin >> a >> b){
  int g = __gcd(a,b);
  int l = a*b/g;
  cout << g << " " << l << endl;
 } 
 return 0;
}