#include <stdio.h>

int gcd(long a, long b);

int main(void)
{
	long a, b;
	
	while (scanf("%ld%ld", &a, &b) != EOF){
		printf("%d\n", gcd(a, b));
	}
	
	return (0);
}

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