#include<stdio.h>
int main(void)
{
	int a,b,x,y,z;
	while(scanf("%d %d",&a,&b)!=EOF) {
		if(a>=b) {
			x=a;
			y=b;
		}
		else {
			x=b;
			y=a;
		}
		while(y!=0) {
			z=x%y;
			x=y;
			y=z;
		}
		printf("%d\n",x);
	}
	return 0;
}