#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a, b;
	while (cin >> a >> b) {
		for (int i = min(a,b); i > 0; i--)
		{
			if (a%i == 0 && b%i == 0)
			{
				cout << i << endl;
				goto Cpp;
			}
		}
		Cpp:
		for (int i = 0; i < 1; i++)
		{

		}
	}
}