#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 dis=(xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);   
       dis = pow(dis,0.5);
       if(dis>ra+rb){
printf("%d\n",0);
continue;
}else if(dis<ra+rb && dis>fabs(ra-rb)){
printf("%d\n",1);
continue;
}else if(dis<fabs(ra-rb)){
	if(ra>rb){
printf("%d\n",2);
	}else{
		printf("%d\n",2);
	}
}

}
return 0;
}