#include <stdio.h>
 
long gcd(long a, long b)
{
    if (a % b == 0){
        return b;
    }
     
    gcd(b, a % b);
}
 
int main(void)
{
    long a, b, c, g;
     
    while (scanf("%ld %ld", &a, &b) != EOF){
        if (a < b){
            c = a;
            a = b;
            b = c;
        }
        g = gcd(a, b);
        printf("%ld\n", g);
    }   
    return 0;
}