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