using namespace std;

int main(void){
  int a,b,tmp;

  while(cin>>a>>b){
    if(a<b) swap(a,b);

    while(1){
      if(a%b==0) break;

      tmp = a%b;
      a = b;
      b = tmp;
    }
    cout<<b<<endl;
  }

  return 0;
}