Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"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<cstdio>
long long gcd(long long a,long long b)
{
    
    return b==0?a:gcd(b,a%b);
}
int main()
{
    long long a,b;
    while (scanf("%lld%lld",&a,&b)==2)
    {
    	long long sum=gcd(a,b);
    	long long num=a/sum*b;
    	printf("%lld %lld\n",sum,num);
	}
    return 0;
}

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

using namespace std;

long gcd(long a, long b);
long lcm(long a, long b);

int main(){
  vector<long> a,b;
  long c,d;
  while(cin >> c >> d){
    a.push_back(c);
    b.push_back(d);
  }
  
  for(int i=0; i<a.size(); i++){
    cout << gcd(a[i],b[i]) << " " << lcm(a[i],b[i]) << endl;
  }

  return 0;
}

long gcd(long a, long b){
  long tmp;
  while(a%b != 0){
    tmp = a;
    a = b;
    b = tmp%b;
  }
  return b;
}

long lcm(long a, long b){
  long c=a,d=b;
  while(a != b){
    if(a > b){
      b+=d;
    }else{
      a+=c;
    }
  }
  return a;
}

C++: #include <stdio.h>

int main(void) {
	int buf,i,c;
	long int a,b,gcd = 1, lcm;
	
	while(scanf("%ld%ld",&a,&b) != EOF){
		if(b > a){buf = a;a = b;b = buf;}
		for(i = 2; a/2 > i;i++){
			if(b%(a/i) == 0) {gcd = a/i;break;}
		}
		for(i = 1; ;i++){
			if((a*i)%b == 0) {lcm = a*i;break;}
		}
		printf("%d %d\n",gcd, lcm);
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
ll gcd(ll m, ll n){
      while(m!=n){
  		if (m>n) m = m - n;
  		else n = n - m;
  	}
  	return m;
}
ll lcm(ll m,ll n){
      return ((m/gcd(m, n))*n);
}
int main(){
      ll a,b;
      while(cin>>a>>b){
            cout<<gcd(a,b)<<' '<<lcm(a,b)<<endl;
      }
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
ll a,b;
ll gcd(ll m,ll n)
{
    if(m==0)return n;
    if(n==0)return m;
    return gcd(n,m%n);
}
int main()
{
    while(~scanf("%lld%lld",&a,&b))
    {
        ll ans1=gcd(a,b);
        ll ans2=a*b/ans1;
        printf("%lld %lld\n",ans1,ans2);
    }
    return 0;
}

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

C++: #include <stdio.h>

#include <algorithm>

using namespace std;

int getGcd(int a, int b) {
  if (a < b) {
    swap(a, b);
  }
  int rem = a % b;
  while (rem != 0) {
    a = b;
    b = rem;
    rem = a % b;
  }
  return b;
}

int main() {
  //freopen("GcdAndLcm.in", "r", stdin);
  int a, b;
  while (scanf("%d%d", &a, &b) == 2) {
    int gcd = getGcd(a, b);
    int lcm = (long long)a * b / gcd;
    printf("%d %d\n", gcd, lcm);
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

typedef long long ll;

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

ll lcm(int a,int b){
	//int table[2][100000];
	//for(int i = 0; i < 2; i++)
	//	fill(table[i],table[i]+100000,0);
	//// 1ÍÇ¿çÌà1Â¾¯Â
	//table[0][1] = 1;
	//table[1][1] = 1;

	//int t_a=a;
	//for(int i = 2; i*i <= t_a; i++){
	//	while(t_a % i == 0){
	//		table[0][i]++;
	//		t_a/=i;
	//	}
	//}
	//if(table[0][t_a] == 0)
	//	table[0][t_a]=1;

	//int t_b=b;
	//for(int i = 2; i*i <= t_b; i++){
	//	while(t_b % i == 0){
	//		table[1][i]++;
	//		t_b/=i;
	//	}
	//}
	//if(table[1][t_b] == 0)
	//	table[1][t_b]=1;

	//ll mul = 1;
	//for(int i = 2; i <= 100000; i++){
	//	if(table[0][i] == 0 && table[1][i] == 0)
	//		continue;
	//	else{
	//		int mc = max(table[0][i],table[1][i]);
	//		for(int j = 0; j < mc; j++)
	//			mul *= i;
	//	}
	//}

	ll mul = 1;
	mul = (b/gcd(a,b))*a;

	return mul;
}

int main(){

	ll a,b;
	while(1){
		cin >> a >> b;
		if(cin.eof()){
			break;
		}
		cout << gcd(a,b) << " " << lcm(a,b) << endl;
	}

	return 0;
}

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

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

long gcd(long a, long b) {

    if ( a < b ) {
        long t = b;
        b = a;
        a = t;
    }

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

}

int main() {

    long a, b;
    
    while (cin >> a >> b) {

        long g = gcd(a, b);
        cout << g << " " << (a / g * b) << endl;
    }
     
    return 0;
}

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

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


int main(){
      ll a,b,c,d;
      while(cin >>a >>b){
            c = gcd(a,b);
            d = a*(b/c);
            cout << c <<' '<< d << endl;
      }
}

C++: #include <stdio.h>

int main(void)
{
	int a, b;
	int l, s;
	int gcd, lcm;
	
	while (scanf("%d %d", &a, &b) != EOF){
		l = a;
		s = b;
		
		if (l < s){
			l = b;
			s = a;
		}
		
		while (s){
			l %= s;
			l += s;
			s = l - s;
			l -= s;
		}
		
		gcd = l;
		lcm = a / gcd * b;
		
		printf("%d %d\n", gcd, lcm);
	}
	
	return (0);
}

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

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

int main()
{
    int min,max,a,b;
    while(scanf("%d %d",&a,&b)!=EOF)
    {
    max = gcd(a,b);
    min = (a/max)*(b/max)*max;
    cout << max << " " << min<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

long long a, b, g;

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

int main()
{
	while(scanf("%lld %lld", &a, &b) != EOF){
		g = gcd(a, b);
		printf("%lld %lld\n", g, a*b/g);
	} 
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <sstream>
using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long

int main()
{
	int a, b;
	while (cin >> a >> b)
	{
		if (a < b) swap(a, b);
		int A = a; int B = b;
		while (1)
		{
			a -= (a / b)*b;
			if (a == 0) break;
			swap(a, b);
		}
		cout << b << " " << A / b*B << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  long long int a,b;
  while(cin>>a>>b){
    cout<<__gcd(a,b)<<" "<<a*(b/__gcd(a,b))<<endl;
  }


}

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