#include <iostream> using namespace std; int findmaxy(int a,int b){ if(a==0) return b; else if(b==0) return a; else if(a>b) return findmaxy(a%b, b); else if(a<b) return findmaxy(a,b%a); else return a; } int main() { int x,y; while(cin>>x>>y){ cout<<findmaxy(x, y)<<endl; } }