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>
using namespace std;

int main(){

	int n, m, low;
	
	while(cin >> n >> m){
		low = min(n, m);
		for(int i=low; i>0; i--){
			if(n % i == 0 && m % i == 0){
				cout << i << endl;
				break;
			}
		}
	}

	return 0;

}

C++: #include<iostream>
using namespace std;
int main(){
	long long x,y,i,j,k,c,s,d,gcd=0;
	for(i=0;i<49;i++){
		cin>>x>>y;
		if(x==0&&y==0)
			cout<<"0"<<endl;
		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 <iostream>
using namespace std;

long long gcd(long long m, long long n){
	//Euclid's algorithm
	if(m<n){ 
		swap(m, n);
	}

	do {
		if(n==0){
			return m;
		}
		
		int swap = m % n;
		m = n;
		n = swap;
	} while(1);
}

//1009
int main(){

	long long m, n;
	while(cin >> m >> n){
		long long  GCD;
		
		GCD = gcd(m, n);
		cout << GCD <<  endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  while(cin>>a>>b){
    int r=a%b; 
    while(r!=0){ 
      a=b; 
      b=r; 
      r=a%b; 
    }
    cout<<b<<endl;
  }
  return 0;
}

C++: #include<iostream>
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int main(){for(int a,b;std::cin>>a>>b;std::cout<<gcd(a,b)<<"\n");}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n1,n2,minv,maxv,i;
  while(cin >> n1){
    cin >> n2;
    minv=min(n1,n2);
    maxv=1;
    for(i=1;i<=minv;i++){
      if(n1%i==0&&n2%i==0) maxv=max(maxv,i);
    }
    cout << maxv << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<boost/math/common_factor.hpp>

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

C++: #include<iostream>
using namespace std;
int main(){
  int x,y;

  while(cin >> x >> y){
    int temp;
    if(x==0 && y==0) break;
    while(y!=0){
      x = x % y;
      temp = x;
      x = y;
      y = temp;
    }
    cout << x << endl;
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

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

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

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

int main(){
  int n,m;

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

  return EXIT_SUCCESS;
}

C++: #include<iostream>
main(){for(int a,b,t;std::cin>>a>>b;printf("%d\n",a))for(;b;a=b,b=t%b)t=a;}

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>
#include <string>
#include <vector>
using namespace std;

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

C++: #include<iostream>
main(){for(int a,b,t;std::cin>>a>>b;printf("%d\n",a))for(;t=b;a=t)b=a%b;}

C++: #include <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define IREP(it,array) for(vector<int>::iterator it=array.begin(); it!=array.end(); ++it)
#define SREP(it,array) for(vector<string>::iterator it=array.begin(); it!=array.end(); ++it)
#define MP make_pair
typedef long long LL;
#define EPS (1e-6)
double zero(double d){
  return d < EPS ? 0.0 : d;
}

typedef pair<int,int> P;

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

int main()
{
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(7);
  int INF = 1000000;

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

  return 0;
}

C++: #include<cstdio>

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

int main(){
	for(int a,b;~scanf("%d%d",&a,&b);)	printf("%d\n",gcd(a,b));
	return 0;
}

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

int main()
{
    int a, b;
    
    while(scanf("%d%d", &a, &b) != EOF)
    {
        printf("%d\n", std::__gcd(a, b));
    }
    
    return 0;
}

C++: #include <iostream>

using namespace std;

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

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

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
    int a,b;
    while(cin >> a >> b) {
        cout << __gcd(a,b) << endl;
    }
    return 0;
}

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

int main()
{
	int m,n;
	
	scanf("%d %d", &m, &n);
	if(m < n) swap(m,n);
	
	while(n != 0){
		int t=n;
		n = m%n;
		m = t;
	}
	
	printf("%d\n", m);
	return (0);
}

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

int gcm(int a, int b)
{
  if (a > b)
  {
    int tmp = a;
    a = b;
    b = tmp;
  }

  for (int i = 1; ; ++i)
  {
    if (a % i == 0 and b % (a / i) == 0 )
    {
      return a / i;
    }
  }
}

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

  return 0;
}

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

int main(void) {
	int p, q;
	while((scanf("%d %d", &p, &q)) == 2) {
		if(q > p) swap(p, q);
		while(q != 0)
			swap(p %= q, q);
		printf("%d\n", p);
	}
	return 0;
}

C++: #include<stdio.h>
int main()
{
	int x,y,z;
	while(scanf("%d%d",&x,&y)>0)
	{
		while(z=x%y)x=y,y=z;
		printf("%d\n",y);
	}
	return 0;
}

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

int main(void){
	int a,b;
	whilecin>>a>>b)
	cout<<__gcd(a,b)<<endl;
}

C++: #include <iostream>
ing main()
{
long int a, b, i, maks;
cin >> a >> b;
if (a > b) maks = a;
else maks = b;
for (i=2;i<=maks;i++)
if (maks % a == 0 && maks % b == 0)
{
cout << i << endl;
break;
}
return 0;
}