#include<iostream> #include<string> #include<cstring> using namespace std; int gcd(int x,int y) { if(!y) return x; else return gcd(y,x%y); } int main() { int t; cin>>t; while(t--) { int a,b; cin>>a>>b; cout<<gcd(a,b)<<endl; } } /* 4 2 8 8 4 72 60 9 7 */