#include <stdio.h>

int main(void) {
	int a, b;
	
	while(scanf("%d %d", &a, &b)!=EOF){
		
		int k=1, t;
		
		while(k){
		if(a>b){
			k=a%b;
			a=k;
		}
		if(b>a){
			k=b%a;
			b=k;
		}
		}
		if(a==0)
		t=b;
		else
		t=a;
		printf("%d\n", t);
	}
	return 0;
}