Go: package main

import "fmt"

func main() {
	var a, b int
	var gcd, lcm int

	for {
		_, err := fmt.Scanf("%d %d", &a, &b)
		if err != nil {
			return
		}

		var big, small int
		// GCD
		if a > b {
			big = a
			small = b
		} else {
			big = b
			small = a
		}

		for {
			if big%small == 0 {
				gcd = small
				break
			} else {
				small, big = big%small, small
			}
		}

		// LCM
		lcm = a * b / gcd

		fmt.Println(gcd, lcm)
	}
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	long long int a = 0;
	long long int b = 0;
	long long int c = 0;
	long long int d = 0;
	long long int e = 0;
	cin >> a;
	cin >> b;
	c = a;
	d = b;
	if (c < d)
	{
		long long int i = 0;
		i = d;
		d = c;
		c = i;
	}
	while (1)
	{
		e = c % d;
		if (e == 0)
		{
			break;
		}
		c = d;
		d = e;
	}
	cout << d << " " << a / d * b << endl;

	return 0;
}

C++: #include<iostream>

int main(){
	int x,y;
	std::cin>>x>>y;
	
	for(int i=x;i>0;++i){
		if(i%x==0&&i%y==0){
			std::cout<<i<<' ';
			break;
		}
	}

	for(int j=x;j>0;--j){
		if(x%j==0&&y%j==0){
			std::cout<<j<<std::endl;
			break;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
long long solve(long long a,long long b){
    int w,max=a,min=b;
    if(a<b){
        max=b;
        min=a;
    }
    while(max%min!=0){
        max-=min;
        if(max<min){
          w=min;
          min=max;
          max=w;
        }
    }
    return min;
}
int main(void){
    long long a,b;
    while(cin>>a>>b){
        cout<<solve(a,b)<<" "<<a*b/solve(a,b)<<endl;
    }
    return 0;
}

C++: long long gcd(long long m, long long n){

	if(m<n){
		long long swap;
		swap = m;
		m = n;
		n = swap;
	}

	do {
		if(n==0){
			return m;
		}
		
		int swap = m % n;
		m = n;
		n = swap;
	} while(1);
}


int main(){
//	m*n = LCM * GCD
	long long m, n;
	while(cin >> m >> n){
		long long  LCM, GCD;
		
		GCD = gcd(m, n);
		LCM = (m*n)/GCD;
		cout << GCD << " " << LCM << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
   int a,b;
 while(scanf("%d %d",&a,&b)==2){
  for(int i = a; i>0;i--){
    if(a%i== 0&& b%i == 0){
     printf("%d %d",i,a*b/i);
		break;
    }

 }
 }
    return 0;
}

C++: #include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
long long int a, b;
long long int gcd()
{
	long long int min = a,other=b;
	if (b < a){
		min = b; other = a;
	}
	int i;
	for (i = 1; i <= sqrt(long double(min)); i++)
	{
		if (min%i == 0)
		{
			if (other % (min / i) == 0)
				return min / i;
		
		}
	}
	for (i = sqrt(long double(min)); i >= 1; i--)
	{
		if (min%i == 0)
		{
			if (other %  i == 0)
				return i;
	     }
		
	}
}
int main()
{
	while (scanf("%lld %lld",&a,&b)==2)
	{
		long long int g = gcd();
		printf("%lld ", g);
		printf("%lld\n", (a / g)*(b / g)*g);
	}
}

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

template<class T> T gcd(T a, T b) {
	return b ? gcd(b, a%b) : a;
}
template<class T> T lcm(T a, T b) {
	return a*b / gcd(a, b);
}

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

C++: #include<stdio.h>
#include<math.h>
long long int g_c_d(long long int a,long long int b);
int main()
{
    long long int lcm,gcd,a,b,product;
    while(scanf("%lld %lld",&a,&b)==2)
    {
        gcd=g_c_d(a,b);
        product=a*b;
        lcm=product/gcd;
        printf("%lld %lld\n",gcd,lcm);
    }
    return(0);
}
long long int g_c_d(long long int a,long long int b)
{
    long long int r;
    if((a%b)==0)
    {
        return(b);
    }
    else
    {
        r=a%b;
        return(g_c_d(b,r));
    }
}

C++: //{Headers
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<algorithm>
#include<list>
#include<queue>
#include<deque>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<bitset>

using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;
#define mp(x,y) make_pair(x,y)
typedef long long ll;
//}

int a,b;

int GCD(int a,int b){return b==0?a:GCD(b,a%b);}

void solve(){
    int gcd=GCD(a,b);
    int lcm=a/gcd*b;
    printf("%d %d\n",gcd,lcm);
}

int main(void){
//    freopen("in.txt","r",stdin);
    while(~scanf("%d%d",&a,&b))
        solve();
    return 0;
}

/*
8 6
50000000 30000000
*/

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int main() {
	double a, b, c, d, e, f;
	while(scanf(" %lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) {
		double multi = b / e;
		double x = ((c - f * multi) - (b - e * multi)) / (a - d * multi);
		double y = (c - (a * x)) / b;
		printf("%.3f %.3f\n", x + 0.0, y + 0.0);
	}
	return 0;
}

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

using namespace std;

int p_cal_gcd(int big, int small)
{   if(small == 0) return big;
    else return p_cal_gcd(small, big % small);
}

int cal_gcd(int a, int b)
{
    return a > b ? p_cal_gcd(a, b) : p_cal_gcd(b, a);
}

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

C++: #include <iostream>
using namespace std;
int main() 
{
    long a, b, c, d, tmp;
    while (std::cin >> 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;
    }
    cout << b << " " << d / b << endl;
    }
       return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

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

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

C++: #include <cstdio>
	int m, n;
int GCD(int m, int n)
{
    while( 1 )
    {
        m = m % n;
		if( m == 0 )
			return n;
		n = n % m;

        if( n == 0 )
			return m;
    }
}
int LCM( int m, int n )
{
		
	return ((m / GCD(m, n)) * n); // lcm = m * n / gcd(m,n)
}
int main()
{
	while(scanf("%d%d",&m,&n)!=EOF)
	{

		printf("%d %d\n",GCD(m,n),LCM(m,n));
	}
	return 0;
}