Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, _ := GCDandLCM(i)
		fmt.Println(g)
	}

}

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

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

//container util
//------------------------------------------
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)

//repetition
//------------------------------------------
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  loop(i,0,n)

//constant
//--------------------------------------------
const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

// output vector
// ------------------------------------------
namespace std {
    template<typename T> ostream & operator<<(ostream& os, vector<T> const& v){
        for(auto it=v.begin(); it!=v.end(); ++it){
            os << *it << (it+1==v.end() ? "" : ",");
        }
        return os;
    }
}

//clear memory
#define clr(a) memset((a), 0 ,sizeof(a))

int gcd(int a, int b){
   int tmp;
   while(a%b!=0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}
 
int lcm(int a,int b){
   return a*b/gcd(a,b);
}
 
bool prime_number(int n){
   if(n==0||n==1) return false;
   vb a(n+1);
   fill(all(a),true);
   loop(i,2,n/2+1){
      if(!a[i]) continue;
      for(int j=2;i*j<=n;j++){
         a[i*j]=false;
      }
   }
   return a[n];
}

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

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

int main(){
	int a,b,c;
	while(cin >> a >> b){
		while(1){
			if(a<b){
				c = b%a;
			}
			else {
				c = a%b;
			}
			if(c!=0){
				a = b;
				b = c;
			}
			else {
				break;
			}
		}
		cout << b <<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<char, int>P;

int main(){
	int a, b;
	function<int(int, int)>gcd = [&](int a, int b) {if (!b)return a; return gcd(b, a%b); };
	while (cin >> a >> b)cout << gcd(a, b) << endl;
	return 0;
}

C++: #include <iostream>
using namespace std;
int func(int a, int b);
int main(){
	int a, b, c;

	while(cin >> a >> b){
		c=func(a,b);
		cout << c << endl;
	}
	
	return 0;
}

int func(int a, int b){
	int d, e, f;

	if(a>=b){ d=a; e=b; }
	else { d=b; e=a; }
	f=e;
	while(1){
		if(d%f==0) return f;
		f=d % e;
		d=e;
		e=f;
	}
}

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

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

int main(void){
  unsigned int a,b;
  while(fscanf(stdin,"%u %u",&a,&b)!=EOF) cout<<euclid(a,b)<<endl;
  return 0;
}

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

using namespace std;

int main() {
    int a, b;
    while(cin >> a >> b && !cin.eof()) {
        if(b > a) swap(a, b);
        while(b) {
            int tmp = a % b;
            a = b;
            b = tmp;
        }
        cout << a << endl;
    }
    return 0;
}

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

int gcd(int a, int b)
{
	int tmp;
	while(b!=0)
	{
		tmp=b;
		b=a%b;
		a=tmp;
	}
	return a;
}

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

C++: #include<iostream>
void swap(int *a,int*b){
    int work;
    work=*a;
    *a=*b;
    *b=work;
    return;
}
using namespace std;
int main(){
    int a,b;

    while(cin>>a>>b){
        if(b>a)swap(&a,&b);
        while(a=a%b,a)swap(&a,&b);
        cout<<b<<endl;
    }
    return 0;
}