#include <stdio.h>
int main() {
    int m, n;
    while ((scanf("%d %d", &m, &n)) != EOF) {
        int l, k;
        if (m > n) {
            l = m;
            k = n;
        } else {
            l = n;
            k = m;
        }
        while (k != 0) {
            int temp = l % k;
            l = k;
            k = temp;
        }
        printf("%d\n", l);
    }
    return 0;
}