Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if count == 51 {
			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<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int main(){
	ios::sync_with_stdio(false);

	llong a, b, gcd, lcm, tmax, tmin;
	vl ar(2);

	while (cin >> a >> b){
		ar[0] = a;
		ar[1] = b;

		while (ar[1]!=0){
			VSORT(ar);
			ar[1] = (int)fmod(ar[1], ar[0]);
		}
		gcd = ar[0];
		lcm = a*b / gcd;

		cout << gcd << " " << lcm << endl;
	}
}

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


long long int gcd(long long int a, long long int b)
{
    long long int ret;
    
    if( a < b ){
        long long int tmp = a;
        a = b;
        b = tmp;
    }
    
    if( b == 0 ) return a;
    
    ret = a % b;
    ret = gcd(b, ret);
    
    return ret;
}


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


int main()
{
    while( 1 ){
        long long int a, b;
        if( scanf("%lld%lld", &a, &b) == EOF ) break;
        printf("%lld %lld\n", gcd(a, b), lcm(a, b));
    }

    return 0;
}

C++: #include<iostream>

void swap(int&, int&);
int gcd(int, int);

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

	return 0;
}

void swap(int& a, int& b)
{
	int tmp = a;
	a = b;
	b = tmp;

	return;
}

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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
long long MOD; template<class T> void mod(T &n){MOD=n;}
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 1
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll


signed main(){
  int a,b;
  while(cin>>a>>b&&a&&b){
    cout<<gcd(a, b)<<" "<<lcm(a, b)<<en;
  }
}

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

C++: #include<stdio.h>

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

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

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

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

using namespace std;

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

int main()
{
	__int64 a, b, t;
	while (scanf("%I64d%I64d", &a, &b) != EOF)
	{
		if (a < b)
			t = gcd(b, a);
		else
			t = gcd(a, b);
		printf("%I64d %I64d\n", t, a * b / t);
	}
	return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) (1e9 + 7);
//const ll MOD = 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);
    ll a, b;
    while (cin >> a >> b) {
        ll g = __gcd(a, b);
        cout << g << " " << a / g * b << endl;
    }
    return 0;
}

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

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

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

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

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

    int max = max(a, b);
    int min = min(a, b);

    long gcd = 0, lcm = 0;

    for(int i = 0; i < min; i++){
        if(max % i == 0) 
          gcd = i;
    }
    
    int j = 1;

    while(1){
      if((max * j) % min == 0){ 
        lcm = max * j;
        break;
      }
      else{ 
        j++;
      }
    }
    
    cout << gcd << " " << lcm << endl;
  }
}

C++: #include<iostream>
int e(int a,int b){return(a%=b)?e(b,a):b;}int main(){for(int a,b,c,s;s=!(std::cin>>a>>b).eof();s&&printf("%ld %ld\n",c,a/c*b))c=e(a,b);}

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

#define ll long long
#define REP(i, a) for(int i=0;i<(int)a;++i)
using namespace std;

ll lcm(ll a, ll b) {
    return a * (b / __algo_gcd(a, b));
}

void solver() {
    ll a,b;
    while(cin>>a>>b){
        cout<<__algo_gcd(a,b)<<" "<<lcm(a,b)<<endl;
    }
}

int main() {
    solver();
    return 0;
}