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