Go: package main

import (
	"fmt"
	"math"
)

func main() {
	n := scanInt()
	for i := 0; i < n; i++ {
		circleTriangle()
	}
}

func scanInt() int {
	var n int
	fmt.Scanf("%d", &n)
	return n
}

func circleTriangle() {
	var x1, y1, x2, y2, x3, y3 float64
	fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)
	a := 2 * (x1 - x2)
	b := 2 * (y1 - y2)
	c := 2 * (x1 - x3)
	d := 2 * (y1 - y3)
	e := x1*x1 - x2*x2 + y1*y1 - y2*y2
	f := x1*x1 - x3*x3 + y1*y1 - y3*y3

	px := (d*e - b*f) / (a*d - b*c)
	py := (a*f - c*e) / (a*d - b*c)

	r := math.Sqrt((x1-px)*(x1-px) + (y1-py)*(y1-py))
	fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
}

Python: import math

def solve(a,b,c,d,e,f):
	x = - (d*(f**2+e**2-b**2-a**2) + b*(-f**2-e**2) + b**2*f + a**2*f + d**2*(b-f) + c**2*(b-f)) / (c*(2*f-2*b) - 2*a*f + 2*b*e + d*(2*a-2*e))
	y = (c*(f**2+e**2-b**2-a**2) + a*(-f**2-e**2) + b**2*e + a**2*e + d**2*(a-e) + c**2*(a-e)) / (c*(2*f-2*b) - 2*a*f + 2*b*e + d*(2*a - 2*e))
	r = math.hypot(x-a, y-b) 
	return x,y,r

n = int(input())
for _ in range(n):
	a,b,c,d,e,f = map(float, input().split())
	x,y,r = solve(a,b,c,d,e,f)
	x += 0.0005
	y += 0.0005
	r += 0.0005
	print("{:.3f} {:.3f} {:.3f}".format(x, y, r))

Python: n = int(input())
for _ in range(n):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    a = pow(pow(x3-x2, 2) + pow(y3-y2, 2), 0.5)
    b = pow(pow(x1-x3, 2) + pow(y1-y3, 2), 0.5)
    c = pow(pow(x2-x1, 2) + pow(y2-y1, 2), 0.5)
    cosA = (b**2+c**2-a**2) / (2*b*c)
    sinA = 1-cosA**2
    r = a / pow(sinA, 0.5) / 2
    a, b, c = x1-x2, y1-y2, -(x1**2 + y1**2) + (x2**2 + y2**2)
    d, e, f = x2-x3, y2-y3, -(x2**2 + y2**2) + (x3**2 + y3**2)
    l = (c*e - b*f) / (e*a - b*d)
    m = (c*d - a*f) / (b*d - a*e)
    print("{0:.3f} {1:.3f} {2:.3f}".format(-l/2, -m/2, r))

Python: import fractions


def calc(x1, y1, x2, y2):
    return 2 * (x2 - x1), 2 * (y2 - y1), x2 ** 2 + y2 ** 2 - x1 ** 2 - y1 ** 2


n = int(input())
for _ in range(n):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    cx1, cy1, z1 = calc(x1, y1, x2, y2)
    cx2, cy2, z2 = calc(x1, y1, x3, y3)
    print(cx1, cy1, z1, cx2, cy2, z2)
    gcd = fractions.gcd(cx1, cx2)
    r1, r2 = cx2 // gcd, cx1 // gcd
    dcy = r1 * cy1 - r2 * cy2
    dz = r1 * z1 - r2 * z2
    y = dz / dcy
    x = (z1 - cy1 * y) / cx1
    r = ((x - x1) ** 2 + (y - y1) ** 2) ** 0.5
    print(*map(lambda x: '{:.3f}'.format(round(x, 3)), (x, y, r)))

Python: N = int(input()) #num of test case
for i in range(N):
    #one test case
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    #vertices
    a = complex(x1, y1)
    b = complex(x2, y2)
    c = complex(x3, y3)
    #make c = 0 by parallel transformation
    a -= c
    b -= c
    
    z0 = abs(a)**2 * b - abs(b)**2 * a
    z0 /= a.conjugate() * b - a * b.conjugate()
    
    #inverse parallel transformation
    z = z0 + c
    zx = "{0:.3f}".format(z.real)
    zy = "{0:.3f}".format(z.imag)
    r  = "{0:.3f}".format(abs(z0))
    print(zx, zy, r)

Python: import math

n = int(input())

for i in range(n):
	x1, y1, x2, y2, x3, y3 = map(float, input().split()) # Get variables
	a = 2 * (x2 - x1)
	b = 2 * (y2 - y1)
	c = math.pow(x2, 2) + math.pow(y2, 2) - math.pow(x1, 2) - math.pow(y1, 2)
	d = 2 * (x3 - x1)
	e = 2 * (y3 - y1)
	f = math.pow(x3, 2) + math.pow(y3, 2) - math.pow(x1, 2) - math.pow(y1, 2)
	px = (c * e - b * f) / (a * e - b * d)
	py = (a * f - c * d) / (a * e - b * d)
	r = math.sqrt(math.pow(x1 - px, 2) + math.pow(y1 - py, 2))
	print('{:.3f}'.format(px) + ' ' + '{:.3f}'.format(py) + ' ' + '{:.3f}'.format(r))

Python: import math
N=int(input())
for i in range(N):
	x1,y1,x2,y2,x3,y3=[float(e) for e in input().split()]
	a1=2*x2-2*x1
	b1=2*y2-2*y1
	c1=x1*x1-x2*x2+y1*y1-y2*y2
	a2=2*x3-2*x1
	b2=2*y3-2*y1
	c2=x1*x1-x3*x3+y1*y1-y3*y3
	x=(b1*c2-b2*c1)/(a1*b2-a2*b1)
	y=(c1*a2-c2*a1)/(a1*b2-a2*b1)
	print('%.3f %.3f %.3f'%(x,y,math.hypot(x1-x,y1-y)))

Python: for i in range(n):
    x1,y1,x2,y2,x3,y3=map(float, input().split())
    x4,y4=0.5*(x2+x3), 0.5*(y2+y3)
    xg,yg=2/3*(2*x1+x4), 2/3*(2*y1+y4)
    xo,yo=(x1+x2+x3)/3, (y1+y2+y3)/3
    r=((xo-x1)**2+(yo-y1)**2)**0.5
    print(xg, yg, r)

Python: import math
input()
while True:
    t=input()
    if t == "":break
    l=[float(i) for i in t.split()]
    px=sum(l[0::2])/3
    py=sum(l[1::2])/3
    r=math.sqrt((l[0]-px)**2+(l[1]-py)**2)
    print("{0} {1} {2}".format([round(i,3) for i in[px,py,r]]))

Python: 
import sys
import math


def solv(x1, y1, x2, y2, x3, y3):
    if y2 == y1:
        xp = 0.5 * (x1 + x2)
        yp = (x3 - x1)/(y3 - y1) * xp + 0.5 * (y1 + y3 - (x3**2 - x1**2)/(y3 - y1))
    elif y3 == y1:
        xp = 0.5 * (x1 + x3)
        yp = (x2 - x1)/(y2 - y1) * xp + 0.5 * (y1 + y2 - (x2**2 - x1**2)/(y2 - y1))
    elif y3 == y2:
        xp = 0.5 * (x2 + x3)
        yp = (x2 - x2)/(y1 - y2) * xp + 0.5 * (y2 + y1 - (x1**2 - x2**2)/(y1 - y2))
    else:
        xp = 0.5 * (y3 - y2 - (x3**2 - x1**2)/(y3 - y1) + (x2**2 - x1**2)/(y2 - y1))/((x2 - x1)/(y2 - y1) - (x3 - x1)/(y3 - y1))
        yp = (x2 - x1)/(y2 - y1) * xp + 0.5 * (y1 + y2 - (x2**2 - x1**2)/(y2 - y1))
    r = math.sqrt((x1 - xp)**2 + (y1 - yp)**2)
    return (xp, yp, r)



#input_file = open(sys.argv[1], "r")
#lines = input_file.readlines()
lines = sys.stdin.readlines()
lines.pop(0)

for line in lines:
    l = map(float, line.split(' '))
    x1 = l[0]
    y1 = l[1]
    x2 = l[2]
    y2 = l[3]
    x3 = l[4]
    y3 = l[5]
    xp, yp, r = solv(x1, y1, x2, y2, x3, y3)
    print("%5.3f %5.3f %5.3f" % (round(xp, 3), round(yp, 3), round(r, 3)))

Python: import math

n=int(input())
for i in range(n):
    deta=[float(i) for i in input().split()]
    h1=math.sqrt((deta[2]-deta[0])**2+(deta[3]-deta[1])**2)
    h2=math.sqrt((deta[4]-deta[2])**2+(deta[5]-deta[3])**2)
    h3=math.sqrt((deta[0]-deta[4])**2+(deta[1]-deta[5])**2)
    sub=(h1+h2+h3)/2
    s=math.sqrt(sub*(sub-h1)*(sub-h2)*(sub-h3))
    sum=((h1*h2*h3)/s)/4
    a=2*deta[2]-2*deta[0]
    b=2*deta[3]-2*deta[1]
    c=-(deta[0]**2+deta[1]**2-(deta[2]**2)-(deta[3]**2))
    d=2*deta[4]-2*deta[2]
    e=2*deta[5]-2*deta[3]
    f=-(deta[2]**2+deta[3]**2-(deta[4]**2)-(deta[5]**2))
    
    x=(e*c-b*f)/(a*e-b*d)
    y=(a*f-c*d)/(a*e-b*d)
    print("{0:.3f} {1:.3f} {2:.3f}".format(x,y,sum))

Python: from math import sqrt
n=int(input())
out=[]
for i in range(n):
	I=list(map(float,input().split(" ")))
	#( (x_0,y_0), (x_1,y_1) , (x_2,y_2) )
	a_1=I[2]-I[0] #x_1-x_0
	a_2=I[4]-I[0] #x_2-x_0
	b_1=I[3]-I[1] #y_1-y_0
	b_2=I[5]-I[1] #y_2-y_0
	#print(a_1,b_1,a_2,b_2)

	K=(a_2**2 -a_2*b_2+a_1**2-a_1*b_1)/(a_2*b_1-a_1*b_2)

	O_x=0.5*(b_1-K*b_2)
	O_y=0.5*(b_2+K*b_1)
	O_R=sqrt( (I[0]-O_x)**2  + (I[1]-O_y)**2 )

	out.append( '{:.3f} {:.3f} {:.3f}'.format(O_x,O_y,O_R) )



for i in out:
	print(i)

Python: from decimal import Decimal, ROUND_HALF_UP
n=int(input())
for i in range(n):
    x1,y1,x2,y2,x3,y3=map(float,input().split())
    a=2*(x1-x2)
    b=2*(y1-y2)
    c=x1**2+y1**2-x2**2-y2**2
    d=2*(x1-x3)
    e=2*(y1-y3)
    f=x1**2+y1**2-x3**2-y3**2
    x=(c*e-b*f)/(a*e-b*d)+0.0
    y=(c*d-a*f)/(b*d-a*e)+0.0
    r=((x-x1)**2+(y-y1)**2)**0.5
    print(Decimal(str(x)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP),Decimal(str(y)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP),Decimal(str(r)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP))

Python: n = int(input())
datasets = [0]*n
#datasets[k] == [x1k,y1k,x2k,y2k,x3k,y3k]
for i in range(0,n):
  datasets[i] = list(map(float,input().split()))



for data in datasets:
  x1p2=(data[0]+data[2])
  x1m2=(data[0]-data[2])
  x1p3=(data[0]+data[4])
  x1m3=(data[0]-data[4])
  y1p2=(data[1]+data[3])
  y1m2=(data[1]-data[3])
  y1p3=(data[1]+data[5])
  y1m3=(data[1]-data[5])
  x=(x1p2*x1m2*y1m3+y1p2*y1m2*y1m3-x1p3*x1m3*y1m2-y1p3*y1m3*y1m2)/(2*(x1m2*y1m3-x1m3*y1m2))
  y=(y1p2*y1m2*x1m3+x1p2*x1m2*x1m3-y1p3*y1m3*x1m2-x1p3*x1m3*x1m2)/(2*(y1m2*x1m3-y1m3*x1m2))
  r=((x-data[0])**2+(y-data[1])**2)**(1/2)
  print("{0:.3f} {1:.3f} {2:.3f}\n".format(x,y,r))