#coding: utf-8
include Math

class Point

	def initialize(args)
		@x,@y = args[0],args[1]
	end

	def x 
		return @x
	end

	def y
		return @y
	end
end



n = 0

n = gets.chomp.to_i

n.times{|i|
	str = gets.chomp.split(' ').map(&:to_f)
	
	a = Point.new(str[0,2])
	b = Point.new(str[2,2])
	c = Point.new(str[4,2])

	#外心
	x = 0.5 * (((c.y-b.y)*(b.x**2-a.x**2+b.y**2-a.y**2)-(b.y-a.y)*(c.x**2-b.x**2+c.y**2-b.y**2))/((b.x-a.x)*(c.y-b.y)-(b.y-a.y)*(c.x-b.x))).to_f
	y = 0.5 *( (-(c.x-b.x)*(b.x**2-a.x**2+b.y**2-a.y**2)+(b.x-a.x)*(c.x**2+c.y**2-b.x**2-b.y**2))/((b.x-a.x)*(c.y-b.y)-(b.y-a.y)*(c.x-b.x))).to_f

	#外接円の半径
	ab = sqrt((b.x-a.x)**2 + (b.y-a.y)**2)
	bc = sqrt((b.x-c.x)**2 + (b.y-c.y)**2)
	ac = sqrt((c.x-a.x)**2 + (c.y-a.y)**2)
	s = (ab+bc+ac)/2
	ss = sqrt(s*(s-ab)*(s-bc)*(s-ac))
	r = ab*bc*ac/(4*ss)
	
	puts sprintf("%.3f %.3f %.3f", x,y,r)
}