#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

template<typename Integer>
Integer GCD(Integer a, Integer b){
  if(!b)return a;
  else return GCD(b,a%b);
}

int main(){
while(true){
int a,b;
cin>>a>>b;
if(cin.eof())break;
cout<<GCD(a,b)<<endl;
}
return 0;
}