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++: //↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑

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

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

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

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

int gcd(int a,int b){
    int c;
    if(a<b){
        a+=b;
        b=a-b;
        a-=b;
    }
    while(b!=0){
        c=a%b;
        a=b;
        b=c;
    }
    return a;
}
 
int main(){
    int data0,data1;
    int answer;
    while(cin>>data0>>data1){
        answer=gcd(data0,data1);
        cout<<answer<<" "<<data0/answer*data1<<endl;
    }
}

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

int gcd(int a, int b)
{
    int i;
    if (b > a){
        int j = a;
        a = b;
        b = j;
    }
	for (i = a; i*i >= a; i--){
		if (a % i == 0)
			if( b % i == 0)
				return i;
	}
}


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<iostream>
using namespace std;
int main(){
  int sn = 0;
  int bn = 0;
  int p,mem,d1,d2,f,lcm,gcd;
  int count = 0;
  while(cin>>sn>>bn){
  if(sn>bn){
    mem = bn;
    bn = sn;
    sn = mem;
  }
  p = bn * sn;
  for(int i=bn;i<=p;i++){
    if(i%sn==0&&i%bn==0) lcm = i;
    break;
  }
  for(int i=sn;i>=1;i--){
    if(sn%i==0&&bn%i==0) gcd = i;
    break;
  }
  /*d1 = lcm;
  while(d1==0){
    d1 = d1 / 10;
    count++;
  } 
  d1 = count;
  count = 0;
  d2 = gcd;
  while(d2==0){
    d2 = d2 /10;
    count++;
  }
  d2 = count;
  f = d1 - 2;*/
  cout << gcd << ' '<< lcm <<endl;
  /*cout << "最大公倍数は　"　<< gcd << ' ' <<　"です。" << endl;
  cout << "最大公約数は"　<< lcm;  
  for(i=0;i<f;i++) cout << ' ';
  cout << "です。"　<< endl;*/
  }
  return 0;
}

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

long long gcd(long long a, long long b){
    long long x,r;
    if(a < b){
      x = a;
      a = b;
      b = x;
      }
    for(x = 0; b != 0; x++){
      r = a%b;
      a = b;
      b = r;
    }
    return a;
}
int main(void){
    long long a, b;

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

    return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int d(int n,int m)
{
    int t;
    while(m!=0)
    {
        if(n<m) {t=n;n=m;m=t;}
        t=m;
        m=n%m;
        n=t;
    }
    return n;
}
int main()
{
    int t,n,m;
    while(1)
    {
        cin>>n>>m;
        t=d(n,m);
        cout<<t<<" "<<n*(m/t)<<endl;
    }
    return 0;
}

C++: #pragma  warning (disable:4996)
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int gcd(int d, int x){
	if (x == 0) return d;
	else return gcd(x, d%x);
}
long long lcm(int a, int b){
	int g = gcd(a, b);
	return a / g*b;
}
int main(){
	int n, m;
	while (cin >> n >> m){
		int s = n + m;
		n = max(n, m);
		m = s - n;
		cout << gcd(n, m) << " " << lcm(n, m) << endl;
	}return 0;
}

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

long long a,b;

long long gcd(long long x,long long y){
  if(y == 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++: #define scanf_s scanf
#include <stdio.h>
#include <iostream>
using namespace std;
#define MAX 200
int main(void)
{
	long long int a, b, c, x, y;
	while (scanf_s("%lld %lld", &a, &b) != EOF) {
		if (b > a) { x = a; a = b; b = x; }
		x = a; y = b;
		c = a % b;
		while (c != 0) {
			a = b; b = c;
			c = a % b;
		}
		printf("%lld %lld\n", b, x * y / b);
	}
}

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

int main(){
	long a, b, _a, _b, r;
	while( cin >> a >> b)
	{
		if( a < b ) swap(a, b);
		_a = a; _b = b;
		while( ( r = _a % _b ) != 0 ){
			_a = _b;
			_b = r;
		}
		cout << _b << " " << (a / _b) * b << "\n";
	}
	return 0;
}

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

int main(){
  int a,b,t,k;

  for(int n=0;n<50;n++){
    cin>>a;
    cin>>b;
    t=1;
    for(int i=1;i<2000000;i++){
      if(a%i==0&&b%i==0){
        a=a/i;
        b=b/i;
        t=i*t;
      }
    }
    k=t*a*b;
    cout<<t<<" "<<k;
  }
  return 0;
}

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

long gcd(long a, long b){
    if(a < b){
        swap(a, b);
    }else{
        while(b > 0){
            int r = a % b;
            a = b;
            b = r;
        }
    }
    return a;
}

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

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

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

int main(){
	int a,b;
	int i=1;
	int j=1;
	cin>>a>>b;
		while(1){
		if(a%i!=0){
			i++;
			continue;
		}
		if(b%j!=0){
			j++;
			continue;
		}
		if(a/i<b/j){
			j++;
		}
		if(a/i>b/j){
			i++;
		}
		if(a/i==b/j){
		cout<<a/i<<" ";
		break;
		}
	}
	
	i=1;
	j=1;
	while(1){
	if(a*i<b*j){
		i++;
	}
	if(a*i>b*j){
		j++;
	}
	if(a*i==b*j){
		cout<<a*i<<endl;
		break;
	}
	}
return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){

  long long a;
  long long b;
  long long result;
  long long temp1;
  long long temp2;

  while( cin >> a >> b ){

    temp1 = a;
    temp2 = b;

    while(1){
      result = a % b;
      if( result == 0 )break;
      else a = b;  b = result;
    }
    cout << b << " " << temp1 / b * temp2 << endl;
  }
  return 0;
}

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

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

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

C++: #include<bits/stdc++.h>
using namespace std;
int n,m;
int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
int main()
{
    while(cin>>n>>m){
        int d=gcd(n,m);
        int lcm=n/d*m;
        cout<<d<<" "<<lcm<<endl;
    }
    return 0;
}