#include<stdio.h>

int main(){
  int x = 0;
  int y = 0;
  int amari = 0;
  int syou = 0;
  int i = 0;

while(1){
scanf("%d%d",&x,&y);
if(1 <= x && y <= 1000000000){
  break;
}


if(x < y){
  while(1){
    amari = y % x;
    if(amari == 0){
      syou = x;
      break;
    }
    else{
      y = x;
      x = amari;
    }
  }
}

if(x > y){
  while(1){
    amari = x % y;
    if(amari == 0){
      syou = y;
      break;
    }
    else{
      x = y;
      y = amari;
    }
  }
}

else if(x == y){
  syou = x;
}
printf("%d",syou);
printf("\n");
return 0;

}

