#include<stdio.h>

int main()
{
    long long int a, b, c, d;

    while(2==scanf("%lld %lld", &a, &b)){
        if(b>a){
            c=a;
            a=b;
            b=c;
        }

        while(a%b!=0){
            d=a%b;
            a=b;
            b=d;
        }
        printf("%lld\n", b);
    }

    return 0;
}