#include <stdio.h>

int getGCD(int a,int b){
        int r;
        while(1){
                r = a % b;
                if(r <= 0){return b;}
                a = b;
                b = r;
        }

}

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