#include <stdio.h>

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