Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [100]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == 0 {
			break
		}
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define REP(i,N) for(int i = 0; i < (int)N; i++)

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

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

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

int main(){

	double x,y;
	double a,b,c;
	bool flag;

	while(cin>>x>>y){

		flag = true;

		a=max(x,y);
		b=min(x,y);

		while(flag){

			c=abs(a-b);
			a=b;b=c;
			if(a==b)flag=false;

		}

		printf("%d %d\n",static_cast<int>(a),static_cast<int>((x*y)/a));
//		cout<<setprecision(0)<<a<<" "<<(x*y)/a;

	}

	return 0;
}

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

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

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

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

C++: #include<iostream>

int gcd(int x,int y);
int lcm(int x,int y);

int main()
{
	int a,b;
	while(1){
		std::cin>>a>>b;
		if(std::cin.eof())break;
		std::cout<<gcd(a,b)<<' '<<lcm(a,b)<<std::endl;
	}
}

int gcd(int x,int y)
{
	int z;
	while(y!=0)
	{
		z=x%y;
		x=y;
		y=z;
	}
	return x;
}

int lcm(int x,int y)
{
	int g=gcd(x,y);
	return x/g*y;
}

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

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

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

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

 using namespace std;
 int gcd(int a, int b)
{
    
}



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

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


int gcd(int a,int b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int gcd2(int a,int b)
{
    while(b!=0)
    {
        int temp=a;
        a=b;
        b=temp%a;
    }
    return a;
}
typedef long long LL;
LL LCM(int a,int b)
{
    int multi=gcd(a,b);
    return (LL)a*(b/multi);
}
int main()
{
    int a,b;
    while(~scanf("%d%d",&a,&b))
    {
        cout<<gcd(a,b)<<" "<<LCM(a,b)<<endl;
    }
    return 0;
}

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


int main(){


    long long a,b,c=12,temp,p;
    while (scanf("%lld %lld",&a,&b)!=EOF)
    {
        c=12;

    if(a > b)
    {
        temp = a;
        a = b;
        b = temp;
    }
    p = a*b;
    while(c != 0)
    {
       c = a%b;
       a = b;
       b = c;
    }

    printf("%lld ",a);
    printf("%lld\n",p/a);
    }
    return 0;
}

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

using namespace std;

int main(){
    int a,b;
    while(cin>>a>>b){
        int temp_a = a;
        int temp_b = b;
        while(1){
            int l = max(temp_a,temp_b);
            int r = min(temp_a,temp_b);
            l = l-r;
            if(l==r){
                cout<<l<<" "<<a/l * b/l * l <<endl;
                break;
            }else{
                temp_a = l;
                temp_b = r;
            }
        }
    }
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int a, b;
	while( cin >> a >> b ){
		int gcd = 1, lcm;
		//cout << max(a,b) << endl;
		for( int i = 2; i < max(a,b); i++ ){
			if( a%i == 0 && b%i == 0 ){
				gcd = i;
			}
		}
		lcm = (a / gcd) * b;
		cout << gcd << ' ' << lcm << endl;
	}
}

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

C++: #include <iostream>

int GCD(int a, int b) {
	int c = std::max(a, b),
		d = std::min(a, b);
	while (c != d) {
		c -= d;

		int tmp[] = {c, d};
		c = std::max(tmp[0], tmp[1]);
		d = std::min(tmp[0], tmp[1]);
	}

	return c;
}

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

C++: #include<stdio.h>
 #include<math.h> 
int main(){ unsigned int a,b;
 while(~scanf("%u%u",&a,&b)){ 
unsigned int c=a,d=b; while(a>0&&b>0){
 if(a>b)a=a%b; 
else b=b%a; } 
printf("%u %u\n",a+b,c/(a+b)*d);
 }

 }

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


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



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++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

constexpr int gcd(int a, int b) {
  int c = 0;
  while (a) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}

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

void solve() {
  int a, b;
  while (cin >> a >> b) {
    cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
  }
}