def f(xa, ya, ra, xb, yb, rb)
  distance = xa ** 2 - 2 * xa * xb + xb ** 2 + ya ** 2 - 2 * ya * yb + yb ** 2
  if distance <= (ra + rb) ** 2
    if distance <= ra ** 2 - 2 * ra * rb + rb ** 2
      return 2 * (ra <=> rb)
    else
      return 1
    end
  else
    return 0
  end
end
gets.to_i.times do
  coordinate = gets.split(" ").map(&:to_f)
  puts f(*coordinate)
end