#include<stdio.h>

int main(){
  int x,y,z,temp;
  
  while(scanf("%d %d",&x,&y)!=EOF){

    if(y < x){
      temp=x;
      x=y;
      y=temp;
    }
    
    while(1){
      z=x%y;
      if(z==0) break;
      x=y;
      y=z;
    }
    printf("%d\n",y);
  }
  
  return 0;
}