#include <stdio.h>

int gcd(int a, int b)
{
	if (a % b) return gcd(b, a % b);
	return (b);
}

void swap(int *a, int *b)
{
	int tmp;

	tmp = *a;
	*a = *b;
	*b = tmp;
}

int main(void)
{
	int x, y;

	while (~scanf("%d %d", &x, &y)){
		if (x > y) swap(&x, &y);
		printf("%d\n", gcd(y, x));
	}

	return (0);
}