#include<stdio.h>

int main(){

  int x, y, a, b, stock;

  while(scanf("%d %d",&a,&b) != EOF){
    if(a < b){
      x = b;
      y = a;
    }else{
      x = a;
      y = b;
    }
    while(y != 0){
      x %= y;
      stock = x;
      x = y;
      y = stock;
    }

    printf("%d\n",x);
  }

  return 0;
}