#include <stdio.h>

int euclide(int a,int b){
    int division;
    
    division = a % b;
    a = b;
    b = division;
    
    if(b != 0) euclide(a,b); 
    else return a;
    
}
int main(){
    
    int a,b,tmp;
    while(1){
        if ((scanf("%d%d",&a,&b)) == EOF) break;
        
        if(a < b)
        {
             tmp = a;
             a = b;
             b = tmp;
        }
        printf("%d\n",euclide(a,b));
    }
    return 0;
}