#include <stdio.h>

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