using namespace std; int gcd(int a,int b){ return b?gcd(b,a%b):a; } int n; int main(){ cin>>n; int a,b; while(n–){ cin>>a>>b; cout<<gcd(a,b)<<endl; }
return 0;
}