#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

/**
 * 求x、y的最大公约数--递归实现
 * @param x
 * @param y
 * @return
 */
int getGCD(int x, int y);


/**
 * 最大公约数--哈尔滨工业大学
 * @return
 */
int main() {
    int x, y;
    while (cin >> x >> y) {
        cout << getGCD(x, y) << endl;
    }

    return 0;
}

int getGCD(int x, int y) {
    //递归出口
    if (y == 0) {
        return x;
    }
    return getGCD(y, x % y);
}