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 <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b;
  while(cin >> a >> b){
    cout << gcd(a,b)<<endl;
  }
  return 0;
}

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

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
using namespace std;
int main(){
    int a,b;
    while(cin>>a>>b){
        if(a<b)swap(a,b);
        for(int i=a;i>1;i--){
            if(b%i==0&&a%i==0){
                cout<<i<<endl;
                break;
            }
        }
    }
}

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

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

C++: #include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
int a,b,k;
int main(){
  while(~scanf("%d %d",&a,&b)){
    k=0;
    for(int i=1;i<=min(a,b);i++){
      if(a%i==0&&b%i==0){k=i;}
    }
    printf("%d\n",k);    
  }
}

C++: #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

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


using namespace std;

int y[100005];

int main() {
	

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

	return 0;

}

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

int gcd( int x, int y){
  int r;
  if( x < y ) swap(x,y);

  while( y > 0 ){
    r = x % y;
    x = y;
    y = r;
  }
  return x;
}

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

  return 0;
}

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