def get_circle_equation(x, y)
  [x, y, 1, x ** 2 + y ** 2]
end

def get_invers_matrix m
  det = m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0] + m[1][0] * m[2][1] * m[0][2]
  det -= m[0][2] * m[1][1] * m[2][0] + m[0][1] * m[1][0] * m[2][2] + m[1][2] * m[2][1] * m[0][0]

  v1 = [m[1][1] * m[2][2] - m[1][2] * m[2][1], m[0][2] * m[2][1] - m[0][1] * m[2][2], m[0][1] * m[1][2] - m[0][2] * m[1][1]]
  v2 = [m[1][2] * m[2][0] - m[1][0] * m[2][2], m[0][0] * m[2][2] - m[0][2] * m[2][0], m[0][2] * m[1][0] - m[0][0] * m[1][2]]
  v3 = [m[1][0] * m[2][1] - m[1][1] * m[2][0], m[0][1] * m[2][0] - m[0][0] * m[2][1], m[0][0] * m[1][1] - m[0][1] * m[1][0]]

  v1 = v1.map{|i| i / det}
  v2 = v2.map{|i| i / det}
  v3 = v3.map{|i| i / det}
  [v1, v2, v3]
end

def mluti(m1, m2)
  v1 = m1[0][0] * m2[0] + m1[0][1] * m2[1] + m1[0][2] * m2[2]
  v2 = m1[1][0] * m2[0] + m1[1][1] * m2[1] + m1[1][2] * m2[2]
  v3 = m1[2][0] * m2[0] + m1[2][1] * m2[1] + m1[2][2] * m2[2]
  [v1, v2, v3]
end
n = gets.to_i

n.times do
  x1, y1, x2, y2, x3, y3 = gets.split.map(&:to_f)
  e1 = get_circle_equation(x1, y1)
  e2 = get_circle_equation(x2, y2)
  e3 = get_circle_equation(x3, y3)

  matrix = [e1[0..2], e2[0..2], e3[0..2]]
  invers_matrix = get_invers_matrix(matrix)
  vec = mluti(invers_matrix, [e1[3], e2[3], e3[3]])
  center = [vec[0] / 2, vec[1] / 2]
  r = Math.sqrt((x1 - center[0]) ** 2 + (y1 - center[1]) ** 2)

  puts sprintf("%.3f %.3f %.3f", center[0].round(3), center[1].round(3), r.round(3))

end