#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


struct C{
	P p;
	double r;
};

vector<P> isCC(const C &c1, const C &c2) {
	double d = abs(c1.p - c2.p);
	if (c1.r + c2.r - d < -EPS || fabs(c1.r - c2.r) - d > EPS) return vector<P>();
	double x = (d*d + c1.r * c1.r - c2.r * c2.r) / (2 * d);
	double y = sqrt(c1.r * c1.r - x * x);
	P diff = (c2.p - c1.p) / d;
	vector<P> res;
	res.pb(c1.p + diff * P(x, y));
	if (y != 0) res.pb(c1.p + diff * P(x, -y));
	return res;
}

int main(){
	int n; cin >> n;
	while (n--) {
		double xa, ya, ra, xb, yb, rb; cin >> xa >> ya >> ra >> xb >> yb >> rb;
		P pa = P(xa, ya), pb = P(xb, yb);
		C ca = (C){pa, ra}, cb = (C){pb, rb};
		int ans;
		if (isCC(ca, cb).size()){
			ans = 1;
		}
		else {
			if (ra + rb - abs(pa - pb) < -EPS) ans = 0;
			else ans = ra > rb ? 2 : -2;
		}
		cout << ans << endl;
	}
	
	return 0;
}