#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int a,b;
while(cin>>a>>b){
for(;;){
if(a>b){
a=a-b;
}
else if(b>a){
b=b-a;
}
else{
break;
}
}
cout<<a<<endl;
}
return 0;
}