#include <stdio.h>

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int a, b;

  while ( scanf ( "%d%d", &a, &b ) == 2 )
  {
    while ( b )
    {
      int t = a % b;
      a = b;
      b = t;
    }
    printf ( "%d\n", a );
  }

  return ( 0 );
}