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