Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		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
		}
		fmt.Printf("%d %d\n", y, lcm/y)
	}
}

C++: #include <iostream>#include <cstdio>using namespace std;int gcd(int a, int b){int p,q,r;if(a<b){p=b;b=a;a=p;}    while(r!=0){    q=b/a;    r=b%a;    b=a;    a=r;    }    return 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++: #include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<math.h>
#define L(_i,_N) for(int _i=0;_i<_N;_i++)
#define C(_Dis) cout<<_Dis<<endl;

using namespace std;

typedef long long int lli;

int main() {
	lli a, b,i;
	while (cin >> a >> b) {
		if (a > b) swap(a, b);
		for (i = a; i > 0; i--) {
			if (a%i == 0 && b%i == 0) break;
		}
		cout << i << " " << (a*b) / i << endl;
	}
	return 0;
}

C++: //
//  main.c
//  c
//
//  Created by ????????? on 2016/12/10.
//  Copyright ?? 2016??´ ?????????. All rights reserved.
//

#include <stdio.h>

int main(){
    long long a, b, r, lcm, x, y;
    while (scanf("%lld %lld",&a,&b) != EOF) {
        x=a;
        y=b;
        for (;;) {
            r=x%y;
            if (r==0)
                break;
            x=y;
            y=r;
        }
        lcm=a*b/y;
        printf("%lld %lld\n",y,lcm);
    }

    return 0;
}

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

int gcd(int x,int y){
  if(x%y==0) return n;
  else{
    int z=x%y
    return gcd(y,z);
  }
}

int main()
{
  int a,b;
  int g;
  long int l;
  cin >> a >> b;
  
  if(a>b) g=gcd(a,b);
  else if(a<b) g=gcd(b,a);
  else g=a;

  l=a*b/g;
  cout << g << " " << l << " " << endl;

  return 0;
}

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

int main(){
	long int gcd[200],num1,num2,lcm[200];
	int a,b;
	int i=0;
	
	while(cin >> a >> b){
		num1 = a;
		num2 = b;
	
		if( a<b ){
			num2 = a;
			num1 = b;
		}
		
		while( (gcd[i]=num1%num2) != 0){
			num1 = num2;
			num2 = ggd[i];
		}
		gcd[i] = num2;
		lcm[i] = a / gcd[i] * b;
		i++;
	}
	
	for(int j=0; j<i; j++)
		cout << gcd[j] <<" "<< lcm[j] << "\n";
	
	return 0;
}

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

using namespace std;

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

int main() {
	int n;int m;
while(cin >> n >> m){
cout << gcn(n,m) << " " << n*m/gcn(n,m) << endl;
}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    long long a,b,i,f;
    cin>>a>>b;
    for(i=20000000;i>0;i--){
        if(a>=2000000000||b>=2000000000){
            break;
        }
        if(a%i==0&&b%i==0){
            cout<<i<<" ";
            
                break;
        }
    }
    f=a*b/i;
    cout<<f<<endl;
    return 0;
}

C++: #include <bits/stdc++.h>
//#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;

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


signed main() {
	ll a, b;
	while (cin >> a >> b) {
		ll mi = gcd(a, b);
		ll ma = a * b / mi;
		cout << mi << " " << ma << endl;
	}
}

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

int gcd(int m,int n){
	if(n==0)
		return m;
		
	return gcd(n,m%n);
}

int main(){
	while(true){
		int a,b;
		cin>>a>>b;
		
		if(cin.eof())
			break;
			
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
	
	return 0;
}

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

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

unsigned int GCD(unsigned int, unsigned int);

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

unsigned int GCD(unsigned int a, unsigned int b) {
  unsigned int c;
  do {
    if (a > b) {
      c = a %= b;
    } else {
      c = b %= a;
    }
  } while (c != 0);
  return a != 0 ? a : b;
}

C++: #include <iostream>
int Gcd(int a, int b) // Greatest Common Divisor
{
    if (!a || !b) {
        return 0;
    }
    while (a != b) {
        if (a > b) {
            a -= b;
        } else {
            b -= a;
        }
    }
    return a;
}
int Lcm(int a, int b, int gcd) // Least Common Multiple
{
    if (!a || !b) {
        return 0;
    }
    return (a * b)/gcd;
}
int main()
{
    int a, b;
    int gcd;
    std::cin >> a >> b;
    gcd = Gcd(a, b);
    std::cout << gcd << " " << Lcm(a, b, gcd) << "\n";
}

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

int gcd(int a, int b){

int p,q,r;

if(a<b){p=b;b=a;a=p;

}

    while(r!=0){
    q=b/a;
    r=b%a;
    b=a;
    a=r;
    }
    return 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++: #include <bits/stdc++.h>
using namespace std;

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

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

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(int x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

ll gcd (ll a, ll b) {
  if (a < b) swap(a, b);
  while (b > 0ll) {
    ll tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
};



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll a, b;
  while (cin >> a >> b) {
    ll g = gcd(a, b);
    ll l = a / g;
    l *= b;
    cout << g << " " << l << endl;
  }

  return 0;
};

C++: #include<iostream>

using namespace std;

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

int main(){
  int a,b;
  cin>>a>>b;

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

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

int main() {
	int a, b, c, d, e, f, g, l;
	while (cin >> a >> b) {
		c = a; d = b;
		e = a; f = b;
		while (1) {
			if (a > b) {
				a %= b;
				if (a == 0) { g = b; break; }
			}
			else if (a<b) {
				b %= a;
				if (b == 0) { g = a; break; }
			}
		}
		while (1) {
			if (c>d) d += f;
			else if (c < d) c += e;
			if (c == d) { l = c; break; }
		}
		cout << g << " " << l << endl;
	}
}