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