#include <iostream>
using namespace std;
int gcd(int m,int n)
{
	if (n == 0)
		return m;
	return gcd(n,m % n);
}

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