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