#include<stdio.h>

int main(){
  int a,b,buf;
  char str[64];
  while(1){
    if(NULL==fgets(str,64,stdin)) break;
    sscanf(str,"%d %d\n",&a,&b);
    if(a<b){
      buf=a;
      a=b;
      b=buf;
    }
    while(a%b){
      buf=a%b;
      a=b;
      b=buf;
    }
    printf("%d\n",b);
  }
  return 0;
}