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