#include<stdio.h>

int main(){
	
	int x,y,X,Y,z;
	
	while( scanf("%d",&x) != EOF ){
		scanf("%d",&y);
		
		if(x>=y){
			X=x;
			Y=y;
		}
		else if(x<y){
			X=y;
			Y=x;
		}
		
		while(1){
			z=X%Y;
			X=Y;
			Y=z;
			if(z==0){
				printf("%d\n",X);
				break;
			}
		}
	}
	
return 0;
}