// AOJ 1009

#include <stdio.h>

int gcd(int a, int b)
{
        int c;
        while (b > 0) {
                c = a % b;
                a = b;
                b = c;
        }
        return a;
}

main()
{
  int x0,x1;
  while(EOF!=scanf("%d %d",&x0,&x1))
  { 
    printf("%d\n",gcd(x0,x1));
  }
  return(0);
}