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