#include <iostream>using namespace std;int main(int argc, char** argv) { int n, m; while(cin>>n>>m){ while(n!=0&&m!=0) (n>m)?n=n%m:m=m%n; cout<<(n==0?m:n)<<endl; } return 0;}