#include <iostream>
using namespace std;
//a%b==b%a
//x%0会报错


int GCD(int a,int b)
{
    if(b==0)return a;
    else return GCD(b,a%b);
}
int main() {
    int a, b;
    while (cin >> a >> b) { // 注意 while 处理多个 case
        cout << GCD(a,b) << endl;
    }
}