#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n1,n2,minv,maxv,i;
  while(cin >> n1){
    cin >> n2;
    minv=min(n1,n2);
    maxv=1;
    for(i=1;i<=minv;i++){
      if(n1%i==0&&n2%i==0) maxv=max(maxv,i);
    }
    cout << maxv << endl;
  }
  return 0;
}