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