#include <iostream>
using namespace std;

int main()
{
  int n, m;
  int k;
  while (cin >> n >> m)
  {
    if (n<m) swap(n,m);
    while (m>0)
    {
      k=n; n=m; m=k % m;
    }
    cout << n << endl;
  }
  return 0;
}