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