#includeint gcd(int a,int b){ int t; while(b) { t=a; a=b; b=t%b; } return a;}int main(){ int n,a,b,i; while(scanf("%d",&n)!=EOF) { for(i=0;i { scanf("%d%d",&a,&b); printf("%d\n",gcd(a,b)); } } return 0;}