#include <iostream>
#include <math.h>
using namespace std;

int main(){
	double xa, ya, ra, xb, yb, rb;
	double x;
	int n;
	
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		
		x = (xa - xb)*(xa - xb) + (ya - yb)*(ya - yb);
		x = sqrt(x);
		if(ra > rb){
			if(ra - rb > x){
				cout << "2";
			}else if(ra + rb > x){
				cout << "1";
			}else {
				cout << "0";
			}
		}else {
			if(rb - ra > x){
				cout << "2";
			}else if(rb + ra > x){
				cout << "1";
			}else {
				cout << "0";
			}
		}
		cout << endl;
	}
	return 0;
}