#include<stdio.h>
long int gcd(long int a,long int b)
{
    long int n=1,tm;
    while(n)
    {
        if(!(a%b))return b;
        tm=b;
        b=a%b;
        a=tm;
    }
}
int main()
{

    long int a,b;
    while(scanf("%ld%ld",&a,&b)!=EOF)
    {
        printf("%ld\n",gcd(a,b));
    }
    return 0;
}