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<iostream>
#include<algorithm>
using namespace std;
int main() {
	long a, b;
	long gcd;
	while (cin >> a >> b) {
		for (int i = min(a,b); i > 0; i--){
			if (a%i == 0 && b%i == 0){
				gcd = i;
				cout << i << " ";
				goto Cs;
			}
		}
		Cs:
		cout << a /gcd * b << endl;
		for (int i = 0; i < 0; i++){}
	}
}

C++: #include<iostream>
using namespace std;
int main(){
    long int a,b;
    while(cin>>a>>b){
        if(b>a)swap(a,b);
        long long int lcm=(long long int)a*b;
        while(a%b){
            long int c=a%b;
            a=b;
            b=c;
        }
        cout<<b<<" "<<lcm/b<<endl;
    }
}

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

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

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int a,b;
	while(cin>>a>>b){
		int64_t g=gcd(a,b);
		cout<<g<<" "s<<a/g*b<<"\n"s;
	}
}

C++: #include <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define IREP(it,array) for(vector<int>::iterator it=array.begin(); it!=array.end(); ++it)
#define SREP(it,array) for(vector<string>::iterator it=array.begin(); it!=array.end(); ++it)
#define MP make_pair
typedef long long LL;

LL gcd( LL m, LL n )
{
  if((0 == m) || (0 == n))
    return 0;
	
  while(m != n)
    {
      if (m > n)
	m -= n;
      else
	n -= m;
    }
  return m;
}
LL lcm( LL m, LL n )
{
  if(( 0 == m ) || (0 == n))
    return 0;
	
  return ((m*n) / gcd(m, n));
}

int main()
{
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(6);

  int INF = 1000000;

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


  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
 long long int a, b, c, temp, min, A, B;
 while(cin >> a >> b){
  if(a < b){
    temp = a;
    a = b;
    b = temp;
  }

    
  else if(a >= b){
    A = a;
    B = b;

    while(1){
      c = A % B;
      if(c == 0) break;
      else if(c != 0){
        A = B;
        B = c;
      }
    }
    min = (a * b) / B;
    cout << B << " " << min << endl;

  }
 }
 return 0; 
}

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

int main() {
	int a, b, gcd, lcm;
	while (cin >> a >> b) {
		for (gcd = a;a%gcd != 0 || b%gcd != 0;gcd--);
		lcm = (a / gcd)*(b / gcd)*gcd;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: #include <stdio.h>

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

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

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

using namespace std;

int find_GCD(int a, int b){
  int max = 0;
  for(int i=min(a, b)/2+1;i>0;i--){
    if(a%i==0 && b%i==0){
      max = i;
      break;
    }
  }
  return max;
}

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

}

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

int main(){
	long long int n[50]={0};
	int i=0;
	while(cin>>n[i++]);
	int nn=i-1;
	for(int j=0;j<nn;j+=2){
		long long int gcd=0,lcm=0;
		for(long long int k=1;k<n[j]+n[j+1];k++){
			if(n[j]%k+n[j+1]%k==0)gcd=k;
		}
		long long int a=0,b=0;
		a=n[j]/gcd,b=n[j+1]/gcd;
		cout<<gcd<<" "<<gcd*a*b<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <iterator>
#include <queue>
#include <stack>
#include <deque>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <string>
#include <cmath>
#include <complex>
#include <functional>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cstdlib>
#include <cctype>

#define REP(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rp(i,c) rep(i,(int)c.size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(u) (u).rbegin(),(u).rend()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl
#define v_delete(a,b) (a).erase(remove((a).begin(), (a).end(), b), (a).end())
#define v_unique(a) (a).erase(unique((a).begin(), (a).end()), (a).end())
#define VV(T) vector<vector< T > >
#define init(a,b) memset((a), (b), sizeof((a)))
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;


template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}

template <class T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
template <class T> void input(T* a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
typedef pair<int,int> pii;

inline bool IN(int x, int y, int w, int h)
{
    return 0 <= x && x < w && 0 <= y && y < h;
}


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

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

int main() {
	// your code goes here
	long long int a,b;
	long long int miner,maxer;
	while(cin >> a >> b){
		int a2=a,b2=b;
		while(max(a2,b2)%min(a2,b2)!=0){
			if(a2>b2)
			a2=a2-b2;
			else
			b2=b2-a2;
		}
		miner =min(a2,b2);
		cout << miner << endl;
		cout << a/miner*b << endl;
	}
	return 0;
}

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

using namespace std;

int calc_gcj(int a, int b) {
	int A=0, B=0;
	if (a == max(a,b)) {
		A = a;
		B = b;
	} else {
		A = b;
		B = a;
	}
	if (A == B) return A;
	else return calc_gcj(B,A%B);
	return -1;
}

void solve(int a, int b) {
	int gcj = calc_gcj(a,b);
	int lcm = a*b/gcj;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

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

int gcd(int m, int n);
int lcm(int m,int n);

int main()
{
	int a[50], b[50];
	int set = 0;
	while( cin >> a[set] >> b[set])
		set++;

	for(int i = 0; i < set; i++)
		cout << gcd(a[i], b[i]) << " " << lcm(a[i], b[i]) << endl;

	return 0;
}

int gcd(int m, int n)
{
	int t;
	if(m < n){
		t = m;
		m = n;
		n = t;
	}
	t = m % n;
	while(t != 0){
		m = n;
		n = t;
		t = m % n;
	}
	return n;
}

int lcm(int m, int n)
{
	if(0 == m || 0 == n)
		return 0;
	return ((m / gcd(m, n)) * n);
}