// Aizu Vol-10 1009: Greatest Common Divisor
// 2017.8.18 bal4u@uu

#include <stdio.h>

int gcd(int a, int b)
{
	int r;
	while (b != 0) r = a % b, a = b, b = r;
	return a;
}

int main()
{
	int a, b;

	while (scanf("%d%d", &a, &b) == 2) printf("%d\n", gcd(a, b));
	return 0;
}