Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	for {
		if sc.Scan() == false {
			break
		}
		str := sc.Text()
		cols := strings.Split(str, " ")
		n, _ := strconv.Atoi(cols[0])
		m, _ := strconv.Atoi(cols[1])
		var gcd int
		if n > m {
			gcd = getGcd(n, m)
		} else {
			gcd = getGcd(m, n)
		}
		fmt.Println(gcd)
	}
}

func getGcd(n int, m int) int {
	var mod int
	nn := n
	mm := m
	for {
		mod = nn % mm
		if mod == 0 {
			break
		}
		nn = mm
		mm = mod
	}
	return mm
}

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

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

int main(){
	long long 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<iostream>
using namespace std;

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

int main(){
    int a, b;
    while( scanf("%d %d", &a, &b) != EOF ){
        cout<<gcd(a,b)<<endl;
    }
    return 0;
}

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

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

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

C++: #include <stdio.h>
int main(){
    int n,m;
    while(scanf("%d %d",&n,&m)!=EOF){
        while(1){
            if(n>m){
                int t=m;
                m=n;
                n=t;
            }
            m%=n;
            if(m==0){
                printf("%d\n",n);
                break;
            }
        }
    }
    return 0;
}

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

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

int main(){
    int a[100000], b[100000],i=0,x;
    while( scanf("%d %d", &a[i++], &b[i++]) != EOF ){
    }
	x=i;
	i=0;
	while(i<x)
	cout<<gcd(a[i++],b[i++])<<endl;
    return 0;
}

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

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