#include <iostream>
#include <vector>
#include <cmath>

int main(int argc, char* argv[]){

	using namespace std;

	int N;
	vector<int> result;
	cin >> N;
	for (int i=0; i<N; ++i){
		double xa,ya,ra,xb,yb,rb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double distance = sqrt(pow((yb - ya),2) + pow((xb - xa), 2));
		if (distance > (ra + rb)){
			result.push_back(0);
		}
		else if (distance < fabs(ra - rb)){
			result.push_back(2);
		}
		else{
			result.push_back(1);
		}
	}
	vector<int>::iterator it = result.begin();
	while (it != result.end()){
		cout << *it << endl;
		++it;
	}
	return 0;
}