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<iostream>

using namespace std;

void swap(int&, int&);

int main(){
  int x, y;

  while(cin >> x >> y){
    if(x < y) swap(x, y);

    while(y != 0){
      x %= y;
      swap(x, y);
    }

    cout << x << endl;
  }
  return 0;
}

void swap(int& x, int& y){
  int z;
  z = x;
  x = y;
  y = z;
}

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

using namespace std;

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

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

using namespace std;

int main() {
	int a,b;
	int MAX,MIN;
	int kari;
	int syoi;
	while (cin >> a >> b) {
		MAX = max(a,b);
		MIN = min(a,b);
		syoi = MAX % MIN;
		while (syoi != 0) {
			kari = MIN;
			MIN = MAX % MIN;
			MAX = kari;
			syoi = MAX % MIN;
		}
		cout << MIN << endl;
	}
	return 0;
}

C++: #include <cstdio>
int solve(int a, int b) {
	if (a%b==0) return a;
	return solve(b,a%b);
}
int main() {
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF) int res=solve(a,b); printf("%d\n",res);
}

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

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

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

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

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

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

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

	return EXIT_SUCCESS;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

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

	}
	return 0;
}

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