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<math.h>
#include<cstdio>
using namespace std;
int main(){
	while(1){
		long long a,b;
		cin>>a>>b;
		long temp;
		if(a<b){temp=a;a=b;b=temp;}
		if(cin.eof()) {break;}
		long q,r;
		while(a%b!=0){
			q=(long long)a/b;		
			r=(long long)a%b;
			a=b;
			b=r;
		}
		cout<<b<<endl;		
	}
	return 0;	
}

C++: #include<iostream>

using namespace std;

int main(void){

	int a,b;

	while(cin>>a>>b){
		for(int i=100000;i>=0;i--){
			if(a%i==0&&b%i==0){
				cout<<i<<endl;
				break;
			}
		}
	}
}

C++: #include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>
#include<bitset>
#include<tuple>
#include<time.h>
#include<list>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }




void solve(){
	int a,b;
	while(cin >> a >> b){
		cout << __gcd(a,b) << endl;
	}
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main()
{
  int A, B;
  while(cin >> A >> B) cout << __gcd(A, B) << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  while(cin>>a>>b){
  if(a>b)swap(a,b);
  while(1){if(!(b%a))break;a--;}
  cout<<a<<endl;}
}

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

using namespace std;

int main(void){

  int a,b,c;

  while( cin >> a >> b ){

    if( a < b ) swap(a,b);

    while(1){
    c = a % b;
    a = b;
    b = c;
    if( b == 0 )break;
    }
    cout << a << endl;
  }
  return 0;
}

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

	return 0;
}

C++: #include<algorithm>
int a,b;main(){for(;~scanf("%d%d",&a,&b);printf("%d\n",std::__gcd(a,b)));}

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

int main(){
	int x,y,d;
	while(true){
		cin >> x >> y;
		while(true){
			d = x % y;
			if(d == 0) break;
			x = y;
			y = d;
		}
		cout << y << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

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

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

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

using namespace std;

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

int main(void) {
    int a, b;

    while(~scanf("%d %d", &a, &b)) {
        cout << gcd(a, b) << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(ll i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(ll i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vvi;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007

ll gcd(ll a, ll b){
	return b==0?a:gcd(b, a%b);
}


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

C++: int gcd( int m, int n ){
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
};

int main(int argc, const char * argv[])
{
    int n, m;
    while(cin >> n >> m){
        //std::cout << n << "," << m << "\n";
        cout << gcd(m, n);
    }
    return 0;
}

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

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

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

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

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

int a,b;

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

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

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

int main()
{
    long long a, b;
    while(scanf ("%lld %lld", &a, &b) != EOF)
    {
              long long x = gcd(a,b);
              printf("%d", x);
    }
return 0; 

}

C++: #include <stdio.h>

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

int main(){
	int x,y;
	while(scanf("%d %d",&x,&y)!=EOF){
		if(x >= y)
			printf("%d\n",calc(x,y));
		else{
			printf("%d\n",calc(y,x));
		}
	}
}