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