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 <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <cmath>
#include <cassert>
using namespace std;

int gcd(int a, int b)
{
  return b ? gcd(b, a%b) : a;
}

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

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

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();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

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

int main() {
  int x, y;

  while(cin >> x >> y) {
    if(x < y) swap(x, y);
    int ans = gcd(x, y);
    cout<< ans << endl;
  }
}

C++: #include <iostream>

using namespace std;
int main(){
	int a,b,ret;
	while(cin>>a>>b, !cin.eof()){
		ret = 0;
		if(a==0 || b==0) ret = 0;
		else if(a>=b){
			while(b!=0){
				ret = b;
				b = a%b;
				a = ret;
			}
			ret = a;
		}else{
			while(a!=0){
				ret = a;
				a = a%b;
				b = ret;
			}
			ret = b;
		}
		cout<<ret<<endl;
	}
}

C++: #include <iostream>

int main(){
	int a, b;
	while(std::cin >> a >> b, !std::cin.eof()){
		while(b){
			int c = b;
			b = a % b, a = c;
		}
		std::cout << a << std::endl;
	}
}

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


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

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

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

int gcd(unsigned long int a,unsigned long int b)
{
    if(b == 0)
       return a;
    else
       return gcd(b, a % b);
}
int main()
{
    unsigned long int a,b;
    scanf("%ul%ul",&a,&b);
    
    printf("%d",gcd(a,b));
    
    

    return 0; 

}

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

using namespace std;

void change(int *, int *);

int main(void)
{
	int x, y;
	
	while(1){
		scanf("%d %d", &x, &y);
		if(x == 0 && y == 0)
		break;
		if(x < y)
			change(&x, &y);
		while(y){
			x %= y;
			change(&x, &y);
		}
		cout << x << endl;
	}
	return 0;
}

void change(int *a, int *b)
{
	int temp;
	temp = *a;
	*a = *b;
	*b = temp;
	
}

C++: #include<iostream>
using namespace std;
int main(){
	int x,y,i,j,k,c,s,d,gcd=0;
	for(i=1;i<50;i++){
		cin>>x>>y;
		if(x>y){
			for(j=1;j<=x;j++){
				k=x%j;
				c=y%j;
				if(k==0&&c==0){
					gcd=j;
				}
				if(j==x){
					cout<<gcd<<endl;
				}
			}
		}else{
			for(j=1;j<=y;j++){
				s=x%j;
				d=y%j;
				if(s==0&&d==0){
					gcd=j;
				}
				if(j==y){
					cout<<gcd<<endl;
				}
			}
		}

	}
	return 0;
}

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

#define INF_MAX 	2147483647
#define INF_MIN 	-2147483648
#define INF 		(1 << 30)
#define SORT(a,n)   sort(a,a+n)
#define EPS			1e-9
#define PI 			acos(-1.0)
#define N 		    2 + 100
#define MOD			10000000007
#define sz(x) 		(int)(x).size()
#define all(x) 		(x).begin(), (x).end()
#define pb 			push_back
#define mp			make_pair
#define ms(x, a) 	memset((x), (a), sizeof(x))
#define ff           first
#define ss           second
#define rep(i,a,b)  for(int i=(a); i<(b); i++)
#define repC(i,x) 	for(size_t i=0; i<x.size(); i++)
#define repIT(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define nn          '\n'
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define i64 __int64
#define isValid(x, y) ( x >= 0 And x < row And y >= 0 And y < col )
#define dump cin.ignore()


typedef long long 		LL;
typedef pair<int,int> 	pii;
typedef vector<int> 	vi;
typedef vector<string> 	vs;
typedef vector<char>	vc;
typedef vector<bool>    vb;
typedef vector< pii >   vii;
typedef map<string,int> msi;
typedef map<int,int>	mii;
typedef map<char,int>   mci;
typedef map<int,string>	mis;

template<class T> T Abs(T x) {return x>0 ? x : -x;}
template<class T> T Max(T a, T b) {return a>b ? a : b;}
template<class T> T Min(T a, T b) {return a<b ? a : b;}
template<class T> T gcd(T a, T b) {return (b ? gcd(b,a%b) : a);}
template< class T > T sq(T x){ return x * x;}
template< class T > T lcm(T a, T b){ return (a / gcd<T>(a, b) * b); }
template< class T > T deb(T cmd) {cout << "debugger:" << endl; cout << cmd << endl;}
template< class T > T deb(T cmd1, T cmd2) {cout << "debugger:" << endl; cout << cmd1 << "\t" << cmd2 << endl;}
template< class T > T deb(T cmd1, T cmd2, T cmd3) {cout << "debugger:" << endl; cout << cmd1 << "\t" << cmd2 << "\t" << cmd3 << endl;}
template< class T > T deb(T cmd1, T cmd2, T cmd3, T cmd4) {cout << "debugger:" << endl; cout << cmd1 << "\t" << cmd2 << "\t" << cmd3 <<"\t" << cmd4 << endl;}
bool isVowel(char ch){ch=tolower(ch);return(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u');}

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

#define MAX 10000

int main()
{
	#ifndef ONLINE_JUDGE
		//freopen("in.txt", "r", stdin);
	#endif

    int a, b;

    while(scanf("%d %d", &a, &b) == 2)
        cout << gcd(a, b) << nn;

    return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

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

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

	return 0;
}

C++: #include <stdio.h>

int main(){
int x,y;

int byakko(int x, inty){
if(x > y)
return x % y;
else
return y % x;

return x;
}

while(scanf("%d %d", &x, &y)){
cout << byakko(x, y) << endl;
}
}