#include <iostream> using namespace std; int main() { int a,b ; while (cin >>a>> b) { while(a !=0 && b!=0) (a>b) ? a=a%b :b=b%a; cout<< (a==0 ? b:a)<<endl; } }