#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	vector<int>a(2);
	while (cin>>a[0]>>a[1]) {
		while (1) {
			sort(a.begin(), a.end());
			if (a[1] % a[0] == 0) { cout << a[0] << endl; break; }
			int d = a[0];
			a[0] = a[1] % a[0];
			a[1] = d;
		}
	}
}