#include <stdio.h>
int main(void) {
	int n,m,tmp,r;
	while(scanf("%d %d",&n,&m)!=EOF){
		if(n<m) {
			tmp=n;
			n=m;
			m=tmp;
		}
		r=n%m;
		while(r!=0){
			n=m;
			m=r;
			r=n%m;
		}
		printf("%d\n",m);
	}
	return 0;
}
