#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF){
        int temp=a%b;
        while(temp){
            a=b;
            b=temp;
            temp=a%b;
        }
        printf("%d\n",b);
    }
    return 0;
}