#include <stdio.h>
int gcdf(int vx,int vy)
{
 int temp;
 temp = (vy==0) ? vx : gcdf(vy,vx%vy);
 return temp;
}
int gcd(int vx,int vy)
{
  return (vx>=vy) ? gcdf(vx,vy) : gcdf(vy,vx);
}
int main(void)
{
  int x,y;
  while(scanf("%d %d",&x,&y) != EOF)
 {
  printf("%d",gcd(x,y));
  putchar('\n');
 }
return 0;
}
 