#include <iostream>
#include <algorithm>
using namespace std;

int maxDivisor(int n1,int n2){
    int mod;
    int maxn = max(n1, n2);
    int minn = min(n1, n2);
    n1 = maxn;
    n2 = minn;

    label: 
    mod = n1 % n2;
    if(mod == 0) return n2;
    else{
        n1 = n2;
        n2 = mod;
        goto label;
    }

}

int main() {
    int n1, n2;

    while(cin >> n1 >> n2){
        cout << maxDivisor(n1, n2);
    }
    
    return 0;
    
}