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<iostream>
using namespace std;

long main(){
	long long int a,b;
	while(cin>>a>>b){
		long long int c=a,d=b;
		while(c!=d){
			if(c>d){
				d+=b;
			}else{
				c+=a;
			}
		}
		while(1){
			d=a%b;
			if(d==0)break;
			a=b;
			b=d;
		}
		cout<<c<<' '<<b<<endl;
	}
	return 0;
}

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

int main() {
    int a,b;
    while (cin>>a>>b) {
        int gcd = a;
        while (!(a % gcd == 0 && b % gcd == 0)) {
            gcd--;
        }

        int i = 1;
        while (a * i % b != 0) {
            i++;
        }
        int lcm = a * i;
        cout << gcd << " " << lcm << endl;

    }
    return 0;
}

C++: #include <stdio.h>
long long main(void){
    int a, b, c, d, tmp;
        scanf("%d %d", &a, &b);
     d = a * b;
    if(a < b) {
        tmp = a;
        a = b;
        b = tmp;
    }
     c = a % b;
    while(c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
        printf("%d %d\n", b, d / b);
            return 0;
}

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

using namespace std;

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

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

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

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

C++: #include<iostream>
#include<string>
#include <algorithm>
#include<iomanip>
#include<cmath>
using std::cin; using std::string;
using std::cout; using std::endl;
using std::sort;
#define rep(X,Y) for(int (X)=0;(X)<(Y);++(X))
#define rept(X,Y,Z) for(int (X)=(Y);(X)<(Z);++(X))
#define repr(X,Y) for(int (X)=(Y);(X)>=0;--(X))
const double pi=3.141592653589793283462;
int main(){
    int n,m;
	int gcb,lcm;
	while(cin>>n>>m){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		if(n%i==0 && m%i==0)
			gcb=i;
	}
	lcm=gcb*(n/gcb)*(m/gcb);
	cout<<gcb<<" "<<lcm<<endl;
		}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()

int gcd (int a , int b){
  if(b>0)
    return gcd(b,a%b);
  else 
    return a;
}
int lcm(int a,int b){
  return ((a / gcd(a,b)) * b);
}
int main(void){
  int a,b;
  while(cin >> a >> b){
    cout<< gcd(a,b) << " " << lcm(a,b) << endl;
  }
}

C++: #include<iostream>
using namespace std;
int main(void){
    long a, b;
    while(cin >> a >> b){
        long _a = a, _b = b;
        long gcd, lcm;

        while(a%b != 0){
            gcd = a%b;
            a = b;
            b = gcd;
        }
        lcm = (_a * _b)/gcd;
        cout << gcd << ' ' << lcm << endl;
    }
}

C++: #include<stdio.h>
int main(){
  long long a,b,m,l;
  while(scanf("%d %d",&a,&b)!=EOF){
    m = a%b;
    l = a*b;
    while(m){
      a = b;
      b = m;
      m = a%b;
    }
    printf("%d %d\n",b,l/b);
  }
}

C++: #include <stdio.h>
int main()
{
  long long i,a,b,max,min,a2,b2;
  while(scanf("%lld %lld",&a,&b)!=EOF){
    if(a<b){
      i=a;
      a=b;
      b=i;
    }
    a2=a;
    b2=b;
    while(1){
      if(b2==0){
	max=a2;
	break;
      } else{
	i=a2%b2;
	a2=b2;
	b2=i;
      }
    }
    min=(a/max)*(b/max)*max;
    printf("%lld %lld\n",max,min);
  }
  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;i++){
      if(a%i==0)
	ayaku.push_back(i);
    }
    for(int j=1;j<=b;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 <iostream>
using namespace std;

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

int main(void){
    int n, m;
    while(cin >> n >> m){
        cout << gcd(n, m) << " " << lcm(n, m) << endl;
    }
}

int lcm(int a, int b){
    int sum_a = a;
    int sum_b = b;
    while(true){
        if(sum_a < sum_b){
            sum_a += a;
        } else if(sum_a > sum_b){
            sum_b += b;
        } else {
            return sum_a;
        }
    }
}

int gcd(int a, int b){
    int smaller = a < b ? a : b;
    int bigger = a > b ? a : b;
    int end_point = smaller / 2 + 1;
    int counter = 0;
    int answer = 0;
    while(counter <= end_point){
        counter++;
        if(a % counter == 0 && b % counter == 0){
            answer = counter;
        }
    }
    return answer;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	long long int a,b,ans;
	while(cin>>a>>b){
		for(int i=2;i<=(min(a,b);i++){
			if(a%i==0 && b%i==0)ans=i;
		}
		cout<<ans<<ans*(a/ans)*(b/ans)<<endl;
	}
    return 0;
}

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

int main() {
	long a,b,G;
	while (cin>>a>>b){
	long c = 1;
	for (c = 1;c <= b ;c= c+1){
		if(a%c == 0 , b%c == 0){
			G = c;
		}
	}cout<<G<<" "<<a*b/G<<endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
long gcd(long n,long m){
	if (m == 0) return n;
	return gcd(m, n % m);
}

long lcm(long n, long m) {
	return m / gcd(n, m)*n;
}

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

C++: #include <iostream>
#include <algorithm>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main() {
    long long a,b,gcd,lcm;
    long long c,d;
    while(true) {
        cin >> a >> b;
        if(!cin)
            return 0;
        c = a; d = b;
        while(true){
            if(a>b)
                swap(a,b);
            b = b%a;
            if(b == 0)
                break;

        }
        gcd = a;
        lcm = c/gcd*d; 
        cout << gcd << ' ' << lcm << '\n';
    }
}

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

long long gcd(long long  a,long long b)
{
	if(b==0)
		return a;
	else
		return gcd(b,a%b);
}
int main()
{
	long long  n, m;
	while(scanf("%ld %ld",&n,&m)!=EOF)
	{
		long long  tmp,tnp;
		if(n>m)
		{
			tmp=n;
			tnp=m;
		}
		else
		{
			tmp=m;
			tnp=n;
		}
		printf("%ld %ld\n",gcd(tmp,tnp),n/gcd(tmp,tnp)*m);
	}
	return 0;
}