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