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>
using namespace std;
long long int sub(long long int x,long long int y);
int sort(long long int *a,long long int *b);
int main(){
long long int a,b,c,x,y;
  cin>>a>>b;
  c=a*b;
  sort(&a,&b);
  while(1){
    if(a==b)break;
    x=sub(a,b);
    sort(&b,&x);
    a=b;
    b=x;
  }
  y=c/b;
  cout<<b<<" "<<y<<endl;
}
long long int sub(long long int x,long long int y){
  return x-y;
}
int sort(long long int *a,long long int *b){
  if(*a<*b){
    long long int temp =*a;
    *a=*b;
    *b=temp;
  }
}

C++: #include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long int lnt;
typedef pair<lnt,lnt> P;
lnt a,b;
lnt euk(lnt x,lnt y){
	if(x<y) return euk(y,x);
	if(y==0) return x;
	return euk(y,x%y);
}

int main()
{
	while(scanf("%lld%lld",&a,&b)!=EOF){
		lnt x=euk(a,b);
		cout<<x<<' '<<a*b/x<<endl;
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>

using namespace std;

int main(int argc, char **argv){
	int a, b;
	while (std::cin >> a >> b) {
		int tmp_a = a, tmp_b = b;
		while (a % b != 0) {
			int tmp = a % b;
			a = b;
			b = tmp;
		}
		cout << b << " " << (tmp_a / b) * (tmp_b / b) * b << endl;
	}
	return 0;
}

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

int getGCD(int a, int b)
{
  /* a??¨b????????§??¬?´???°???????????? */
  int larger = a;
  int smaller = b;
  
  if (larger < smaller) {
    std::swap(larger, smaller);
  }
  
  int sub = larger - smaller;
  
  int ret = larger;
  while (sub > 0) {
    ret = sub;
    larger = sub;
    if (larger < smaller) {
      std::swap(larger, smaller);
    }
    sub = larger - smaller;
  }
  
  return ret;
}

int getLCM(int a, int b)
{
  /* a??¨b???????°???¬?????°???????????? */
  return a / getGCD(a, b) * b;
}

int main(void)
{
  int a, b;
  
  while (std::cin >> a >> b) {
    std::cout << getGCD(a, b) << " " << getLCM(a, b) << std::endl;
  }
  
  return 0;
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int i;
/*int js(long long x,long long y)
{
    for(i=1; ;i++)
    {
        if(i%x==0&&i%y==0)
        {
            break;
        }
    }
    return i;
}*/
main()
{
    long long n,k,j,max,min,x,y,t,a,b;
    while(~scanf("%lld %lld",&x,&y))
    {
        a=x;
        b=y;
       // max=js(x,y);
        if(x>y)
            {
                t=x;
                x=y;
                y=t;
            }
        while(x!=0)
        {
            t=x;
            x=y%x;
            y=t;

        }
        min=y;
        max=a*b/min;
    printf("%lld %lld\n",min,max);
    }

}

C++: #include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>

using namespace std;
int gcd(int x,int y)
{
	if (y==0)
	{
		return x;
	}
	else
	{
		return gcd(y, x%y);
	}
}
int lcm(int x, int y)
{
	return x / gcd(x, y)*y;
}

int main()
{
	long long a, b;
	long long Gcd, Lcm;
	while (scanf("%lld%lld",&a,&b) != EOF)
	{
		printf("%d %d\n", gcd(a, b), lcm(a, b));
	}
	return 0;
}

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

using namespace std;

int main(){
   int a,b;
   double A,B;
   double GCD,LCM;
   double z;
   
   while(cin>>A>>B){
      if(A<B){
         z = A;
         A = B;
         B = z;
      }
      a = static_cast<int>(A);
      b = static_cast<int>(B);
   
      while(1){
         if(a%b == 0){
            GCD = static_cast<double>(b);
            break;
         }
         z = a%b;
         a = b;
         b = z;
      }
      LCM = A*B/GCD;
      
      printf("%.0lf %.0lf\n",GCD,LCM);
   }
   return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
	int n = 45000;
	int p[n] = {0};
	for(int i=2;i<n;i++){
		if(p[i]==0) for(int j=2;j<n/i;j++) p[i*j] = 1;
	}
	int q[n];
	int c = -1;
	for(int i=2;i<n;i++){
		if(p[i]==0){
			c++;
			q[c] = i;
		}
	}
	long a,b;
	while(cin >> a >> b){
		int t[c] = {0};
		int s[c] = {0};
		int as = a;
		while(1){
			int temp = as;
			for(int i=0;i<c;i++){
				if(as%q[i]==0){
					s[i]++;
					as = as/q[i];
				}
			}
			if(temp==as) break;
		}
		int at = b;
		while(1){
			int temp = at;
			for(int i=0;i<c;i++){
				if(at%q[i]==0){
					t[i]++;
					at = at/q[i];
				}
			}
			if(temp==at) break;
		}
		long z = 1;
		if(at==as) z = at;
		long y = z;
		cout << z << " " << y << endl;
		for(int i=0;i<c;i++){
			y *= pow(q[i],max(s[i],t[i]));
			z *= pow(q[i],min(s[i],t[i]));
		}
		cout << z << " " << y << endl;
	}
}

C++: #include <cstdio>
int gcd(int a, int b){
	return b?gcd(b,a%b):a;
}
int main(){
	int a,b;
	while(~scanf("%d%d",&a,&b))
		printf("%d %d\n",gcd(a,b),a/gcd(a,b)*b);
}

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

using _i64 = int64_t;
using _u64 = uint64_t;
using _f64 = double;

#define _for(i, start, end) for(_i64 i = (_i64)start; i < (_i64)end; ++i)
#define _rep(i, number) _for(i, 0, number)
#define _foreach(e, data) for(auto& e : data)
#define _all(data) data.begin(), data.end()

template<typename type>
_i64 _size(const type& data) { return static_cast<_i64>(data.size()); }
template<typename type, size_t size>
_i64 _size(const type (&)[size]) { return static_cast<_i64>(size); }

enum _flag : bool { able = true, disable = false };

struct _time {
    _time(_flag flag) { check = flag; if(!check) { return; } gettime(start); }
    ~_time() {
        if(!check) { return; }; gettime(end);
        _i64 elapse = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cout << endl << "Time: " << elapse << " ms" << endl;
    }
    private:
    using _timer = chrono::time_point<chrono::system_clock>;
    _timer start, end; bool check;
    void gettime(_timer& time) { time = chrono::system_clock::now(); }
};

struct _ini { _ini() { ios::sync_with_stdio(false); cin.tie(nullptr); } } _ini;

_i64 _gcd(_i64 a, _i64 b) {
    return (max(a, b) % min(a, b) != 0 ? _gcd(min(a, b), max(a, b) % min(a, b)) : min(a, b));
}

_i64 _lcm(_i64 a, _i64 b) {
    return a * b / _gcd(a, b);
}

int main() {
    {
        _time time(disable);
        _i64 a, b;
        while(cin >> a >> b) { cout << _gcd(a, b) << " " << _lcm(a, b) << endl; }
    }
    return 0;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
LL lcm(LL a,LL b){
	return a*b/__gcd(a,b);
}
int main(){
	LL a,b;
	while(scanf("%lld %lld",&a,&b)!=EOF){
		printf("%lld %lld\n",__gcd(a,b),lcm(a,b));
	}
}