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>
using namespace std;
main()
{
	while(1)
	{
	
	long long a,b,c,d,num1,num2;
	
	cin>>a;
	if(a==EOF)
	   break;
	cin>>b;
	num1=a;num2=b;
	
	for(;b!=0;)
    {
    	c=a%b;
    	a=b;
    	b=c;
	}
	d=num1*num2/a;
	cout<<a<<" "<<d<<endl;
	
    } 
 }

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;

long long int gcd(long long int m,long long int n){
	if(m==0||n==0){
		return 0;
	}
	while(true){
		if(m>n){
			m %=n;
			if(m==0){
				return n;
			}
		}
		else{
			n %=m;
			if(n==0){
				return m;
			}
		}

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

int main() {
	long long int a,b,G,L;
	while(true){
		cin>>a>>b;
		if (cin.eof())break;
		G=gcd(a,b);
		L=lcm(a,b);
		cout<<G<<" "<<L<<endl;
	}
}

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

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

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

C++: nclude <iostream>

#include <cstdio>

#include <algorithm>

using namespace std;

int main(){

	unsigned long long a,b,c,d,e,f,maxx=0,data,minn=0,data2,m=0,n=0;

	while (scanf("%llu %llu",&a,&b)!=EOF){

		data=max(a,b)

		for (;;){

			if (a%data==0 && b%data==0){

				maxx=data;
				
				break;

			}

			data-=1;

		}

		data=min(a,b);

		data2=max(a,b);

		while(minn==0){	
	
			if (m!=0){

				if (data>=data2){

					n=data2;

					data2=data;

					data=n;

				}

				else{	

					n=data;

					data=data2;

					data2=n;
				
				}

				data*=2;

				m=1;

				if (data==data2) minn=data;	

			}		

		}

		cout<<maxx<<" "<<minn<<endl;

		maxx=0;

		minn=0;

	}

	return 0;

}

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

int main(){
//old
		/* 2014 ??????1
		int a[2],ans;
		cin >> a[0] >> a[1];
		ans = a[0] * a[1];
		cout << ans << endl;
		*/
		/* 2014 ??????2
		int a[6],ans = 0;
		cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
		if(a[0] + a[1] * 5 + a[2] * 10 + a[3] * 50 + a[4] * 100 + a[5] * 500 >= 1000) ans = 1;
		cout << ans << endl;
		*/
		/* 2014 ??????3
		int a,i = 0;
		cin >> a;
		int b[a],c[a],ans[a];
		while(a > i){
			cin >> b[i] >> c[i];
			ans[i] =  b[i] % c[i];
			if(ans[i] == 0) ans[i] = c[i];
			i++;
		}
		i = 0;
		while(a > i){
		cout << ans[i] << endl;
		i++;
		}
		*/
		/* 2014 ??????4
		int a[2],i = 1;
		cin >> a[0];
		int n[a[0]],m[a[0]];
		while (a[0] >= i){
			cin >> n[i] >> m[i];
			i++;
		}
		i = 1;
		cin >> a[1];
		int o[a[1]],p[a[1]];
		while (a[1] >= i){
			cin >> o[i] >> p[i];
			i++;
		}
		i = 1;
		int ii,c,aa;
		aa = a[0] + a[1];
		int ans[aa][2],hh[aa],mm[aa],chk,count = 1;
		while(aa >= i){
			ii = 1;
			chk = 1;
			if(a[0] >= i){
				while(i - 1 >= ii){
					if(n[i] == hh[ii] and m[i] == mm[ii]){
						chk = 0;
					}
					ii++;
				}
				if(chk == 1){ 
					hh[count] = n[i];
					mm[count] = m[i];
					count++;
				}
			}else{
				while(i - 1 >= ii){
					if(o[i - a[0]] == hh[ii] and p[i - a[0]] == mm[ii]){
						chk = 0;
					}
					ii++;
				}
				if(chk == 1){ 
					hh[count] = o[i - a[0]];
					mm[count] = p[i - a[0]];
					count++;
				}		

			}
			i++;
		}
		aa = count - 1;
		i = 1;
		while(aa >= i){
			ii = 1;
			c = 1;
				while(aa >= ii){
						if(hh[i] > hh[ii] or hh[i] == hh[ii] and mm[i] > mm[ii] and i != ii){
							c++;
						}
				ii++;
				}
			ans[c][0] = hh[i];
			ans[c][1] = mm[i];
		 i++;
		}
		i = 1;
		while(aa >= i){
			if(aa == i){
				if(ans[i][1] < 10){
					cout << ans[i][0] << ":" << "0" << ans[i][1] << endl;;
				}else{
					cout << ans[i][0] << ":" << ans[i][1] << endl;;
				}

			}else{
				if(ans[i][1] < 10){
					cout << ans[i][0] << ":" << "0" << ans[i][1] << " ";
				}else{
					cout << ans[i][0] << ":" << ans[i][1] << " ";
				}
			}
			i++;
		}
		//????????°???
		int n,i,ans = 100000,a,risi[2];
		cin >> n;
		for(i = 1;n >= i;i++){
			risi[0] =  ans * 0.05;
			risi[1] = risi[0];
			while(risi[1] >= 1000){risi[1] = risi[1] - 1000;}
				if(risi[1] > 0){risi[0] = risi[0] - risi[1] + 1000;}
			ans = ans + risi[0];
		}
		cout << ans << endl;
		*/
		/*int in,i[4];
		while(cin >> in){
		int ans = 0;
		for(i[0] = 0;9 >= i[0];i[0]++){
			//if(0 > in - i[0]) break;
			//cout << "[1]" <<  i[0] << endl;				
			for(i[1] = 0;9 >= i[1];i[1]++){
				//if(0 > in - ( i[0] + i[1] ) ) break;
				//cout << "[2]" << i[1] << endl;
				for(i[2] = 0;9 >= i[2];i[2]++){
					//if(0 > in - ( i[0] + i[1] + i[2] ) ) break;
					//cout << "[3]" << i[2] << endl;
					for(i[3] = 0;9 >= i[3];i[3]++){
						//if(0 > in - ( i[0] + i[1] + i[2] + i[3] ) ) break;
						//cout << "[4]" << i[3] << endl;
						//cout << "[1] " << i[0] << "  [2] " << i[1] << "  [3] " << i[2] << "  [4] " << i[3] << endl; 
						if(i[0] + i[1] + i[2] + i[3] == in){
						//cout << "[1] " << i[0] << "  [2] " << i[1] << "  [3] " << i[2] << "  [4] " << i[3] << endl; 
						ans++;
						}
					}	
				}
			}
		}
		cout << ans << endl;	
		}*/

		/*int in;
		cin >> in;
		int a[in];
		for(int i = 1;in >= i;i++){
			cout << "[IN] [" << i << "] ";
			cin >> a[i];
		}
		for(int i = 1;in >= i;i++){cout << "[OUT] ["<< i << "] " <<  a[i] << endl;}*/
//old;
		int a,b,GCD[2],OUTPUT[2];
		cin >> a >> b;
		GCD[0] = a;GCD[1] = b;
		while(GCD[0] != GCD[1]){
			if(GCD[0] > GCD[1]){
				GCD[0] = GCD[0] - GCD[1];
			}else if(GCD[1] > GCD[0]){
				GCD[1] = GCD[1] - GCD[0];
			}			
		}
		OUTPUT[0] = GCD[1];
		OUTPUT[1] = a * b / OUTPUT[0];
		cout << OUTPUT[0] << " " << OUTPUT[1] << endl;
}

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

long gcd(long a, long b) {
  long c;
  if(a < b) {
    long temp = a;
    a = b; 
    b = temp;
  }
 
  while (b != 0) {
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

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

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
long long gcd(long long a,long long b)
{
	if(b==0)   return a;
	return gcd(b,a%b);
}
long long n,m;
int main()
{
    while(cin>>n>>m)
	{
		cout<<gcd(n,m)<<" "<<n*m/gcd(n,m)<<endl;
	}
    return 0;
}