#include <stdio.h>
#include <math.h>
  int main(){
    int n,i;
    double xa,ya,ra,xb,yb,rb;
    scanf("%d",&n);
     for(i=0;i<n;i++){
       scanf("%lf%lf%lf%lf%lf%lf",&xa,&ya,&ra,&xb,&yb,&rb);
	   double q=xa-xb;
	   double r=ya-yb;
	   double s=ra-rb;
       double dis=q*q+r*r;   
       dis = sqrt(dis);
       if(dis>ra+rb){
printf("%d\n",0);
continue;
}else if(dis<ra+rb && dis*dis>s*s){
printf("%d\n",1);
continue;
}else if(dis*dis<s*s){
	if(ra>rb){
printf("%d\n",2);
continue;
	}else{
		printf("%d\n",2);
		continue;
	}
}
else{
	printf("%d\n",1);
	continue;
}
}
return 0;
}