#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;


int GCD(int number1, int number2)
{
	int mod = number1 % number2;
	if (mod == 0)
	{
		return number2;
	}
	else
	{
		return GCD(number2,mod);
	}

}

int main()
{

	int number1, number2;
	while (cin >> number1 >> number2)
	{
		cout << GCD(number1, number2);
	}

    /*cin >> number1 >> number2;*/



}