#include <iostream>
using namespace std;
int gcd(int a,int b){	//求最大公约数函数
    int r;
    do{
        r = a%b;
        a = b;
        b = r;
    }while(r != 0);
    
    return a;
}
int main() {
    int a, b;
    while (cin >> a >> b) { // 注意 while 处理多个 case
        cout << gcd(a,b) << endl;
    }
}
// 64 位输出请用 printf("%lld")