#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int gcd(int, int);
int main()
{
int a = 0;
int b = 0;
while (cin >> a >> b)
{
cout << gcd(a, b) << endl;
}
}
int gcd(int a,int b)
{
int r = 0;
while (b != 0)
{
r = a % b;
a = b;
b = r;
}
return a;
}