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