#include<stdio.h>

int main()
{
  int r, x, y, temp;

  while( scanf("%d %d", &x, &y) != EOF )
    {
      if(x<y)
	{
	  temp = x;
	  x = y;
	  y = temp;
	}
 
      while(y>0)
	{		
	  r = x % y;
	  x = y;
	  y = r;
	}
      printf("%d\n",x);
    }
  return(0);
}