def check(xa, ya, ra, xb, yb, rb)
  d = ((xa - xb) ** 2 + (ya - yb) ** 2) ** 0.5
  if (ra - rb) * (ra <=> rb) > d
    return 2 * (ra <=> rb)
  elsif ra + rb < d
    return 0
  else
    return 1
  end
end
def main(input = $stdin)
  n = input.gets.to_i
  n.times do
    puts check(*input.gets.split(" ").map(&:to_f))
  end
end
main