#include <bits/stdc++.h>

int euklides(int a, int b) {
    while (a % b!= 0) {
        int tmp = b;
        b = a % b;
        a = tmp;
    }
    return b;
}

int main()
{
    int a, b;
    while (std::scanf("%d %d", &a, &b) != EOF) {
        (a > b) ? std::cout << euklides(a, b) << std::endl : std::cout << euklides(b, a) << std::endl;
    }
    return 0;
}

