#32842: _ans


yp11151049@yphs.tp.edu.tw (901-26李文睿)


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    while(cin>>n>>m){
        while(n!=0 && m!=0) (n>m) ? n=n%m : m=m%n;
        (n==0) ? cout<<m<<endl : cout<<n<<endl;
    }
}