Go: package main

import (
	"fmt"
	"math"
)

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

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

func cal() {
	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: 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); p = x1**2 - x2**2 + y1**2 - y2**2
    c = 2*(x1 - x3); d = 2*(y1 - y3); q = x1**2 - x3**2 + y1**2 - y3**2
    det = a*d - b*c
    x = d*p - b*q; y = a*q - c*p
    if det < 0:
        x = -x; y = -y; det = -det
    x /= det; y /= det
    r = ((x - x1)**2 + (y - y1)**2)**.5
    print("%.03f %.03f %.03f" % (x, y, r))

Python: # -*- coding: utf-8 -*-

import sys

def length(a, b):
    return ((a[0] - b[0])**2 + (a[1] - b[1])**2)**0.5

def solve_sim_equ(a, b, c, d, e, f):
    '''
    From Problem 0004.
    This function solves following equation.
    ax + by = c
    dx + ey = f
    '''
    if a==0 and d==0:
        if b==0 and e==0:
            return 0., 0.
        if b != 0:
            return 0., c/b+0.
        else:
            return 0., f/e+0.
    elif b==0 and e==0:
        if a != 0:
            return 0., d/a+0.
        else:
            return 0., a/d+0.

    if b == 0:
        a, d = d, a
        b, e = e, b
        c, f = f, c
    g = e / b
    x = (g*c - f) / (g*a - d)
    y = (c - a*x) / b
    return x+0., y+0.


def circumscribed_circle(x, y, z):
    def get_equ_coef(p, q):
        h_x = (p[0] + q[0]) / 2
        h_y = (p[1] + q[1]) / 2
        a = q[1] - p[1]
        b = p[0] - q[0]
        c = b * h_x - a * h_y
        return b, -a, c
    coef = get_equ_coef(x, y) + get_equ_coef(y, z)
    center = solve_sim_equ(*coef)
    r = length(center, x)
    return center, r


def main():
    N = int(input())
    for i in range(N):
        vs = [float(v) for v in input().split()]
        a = (vs[0], vs[1])
        b = (vs[2], vs[3])
        c = (vs[4], vs[5])
        center, r = circumscribed_circle2(a, b, c)
        print('{0:.3f} {1:.3f} {2:.3f}'.format(center[0], center[1], r))


if __name__ == '__main__':
    main()

Python: n = int(input())
datasets = [0]*n
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))

Python: for _ in[0]*int(input()):
 a,d,b,e,c,f=map(float,input().split())
 z=2*(b*f-c*e+c*d-a*f+a*e-b*d)
 x=((e-f)*(a**2+d**2)+(f-d)*(b**2+e**2)+(d-e)*(c**2+f**2))/z
 y=((c-b)*(a**2+d**2)+(a-c)*(b**2+e**2)+(b-a)*(c**2+f**2))/z
 print('{0:.3f} {1:.3f} {2:.3f}'.format(x,y,((a-x)**2+(d-y)**2)**0.5))

Python: def perpendicular_bisector(p, q):
    x = (q[0] - p[0])
    y = (q[1] - p[1])
    return (2 * x, 2 * y, p[0]**2-q[0]**2+p[1]**2-q[1]**2)


def gauss_jordan_elimination(Array):
    # N???M??????Array
    N = len(Array)
    if N == 0:
        return (True, Array)
    else:
        M = len(Array[0])

    A = []
    for i in range(len(Array)):
        A.append(Array[i][:])

    pivot = 0
    L = min(N, M)
    while pivot < L:
        pivot_v = A[pivot][pivot]
        pivot_row = pivot
        for i in range(pivot + 1, L):
            v = max(A[i][pivot], -A[i][pivot])
            if pivot_v < v:
                pivot_row = i
                pivot_v = v
        if pivot_row > pivot:
            for i in range(M):
                A[pivot][i], A[pivot_row][i] = A[pivot_row][i], A[pivot][i]
        if pivot_v == 0:
            return ('False', A)
        inv_pivot = 1 / A[pivot][pivot]
        A[pivot][pivot] = 1
        for i in range(pivot + 1, M):
            A[pivot][i] *= inv_pivot
        for i in range(N):
            if i == pivot:
                continue
            t = -1 * A[i][pivot]
            A[i][pivot] = 0
            for j in range(pivot + 1, M):
                A[i][j] += t * A[pivot][j]
        pivot += 1
    return ('True', A)

n = int(input())
for _ in range(n):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    a = list(perpendicular_bisector((x1, y1), (x2, y2)))
    b = list(perpendicular_bisector((x1, y1), (x3, y3)))
    c = [a, b]
    state, c = gauss_jordan_elimination(c)
    x = c[0][2]
    y = c[1][2]
    r = ((x - x1)**2 + (y - y1)**2)**0.5
    print('{0:.3f} {1:.3f} {2:.3f}'.format(-round(x, 3), -round(y, 3), round(r, 3)))

Python: from math import sin,cos,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

	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 )
	
	print('{:.3f} {:.3f} {:.3f}'.format(O_x,O_y,O_R))
#	out.append( '{:.3f} {:.3f} {:.3f}'.format(O_x,O_y,O_R) )



#	for i in out:
#		print(i)

Python: def main():
    import math
    for i in range(int(input())):
        x1,y1,x2,y2,x3,y3=map(float,input().split())

        a=y1-y2
        b=y1-y3

        if a==0:
            x=(x1+x2)/2
            c=(x3-x1)/(y1-y3)
            d=(-x1-x3)/2+(y1+y3)/2
            y=c*x+d

        elif b==0:
            x=(x1+x3)/2
            c=(x2-x1)/(y1-y2)
            d=(-x1-x3)/2+(y1+y3)/2
            y=c*x+d

        else:
            a=(x2-x1)/(y1-y2)
            b=(-x1-x2)/2+(y1+y2)/2
            c=(x3-x1)/(y1-y3)
            d=(-x1-x3)/2+(y1+y3)/2

            x=(d-b)/(a-c)
            y=a*x+b

        r=math.sqrt((x-x1)**2+(y-y1)**2)

        print("{0:.3f} {1:.3f} {2:.3f}".format(x,y,r))

Python: import math

def run():
    n = int(input())
    epsilon = 1e-20
    for _ in range(n):
        x1, y1, x2, y2, x3, y3 = list(map(float, input().split()))
        u1 = (x1-x3)*(x2-x1)*(x3-x2)
        u2 = (x2-x1)*(y3-y2)*(y3+y2)
        u3 = (x3-x2)*(y2-y1)*(y2+y1)
        v = x1*x2 + x2*y3 + x3*y1 - x1*y3 - x2*y1 + x3*y2
        Py = (-u1 + u2 - u3) / v / 2
        Px = (x2**2 - x1**2 + y2**2 - y1**2 - (y2 - y1)*Py) / (x2-x1 + epsilon) / 2
        r = math.sqrt((Px-x1)**2 + (Py-y1)**2)
        print('{0:.3f} {1:.3f} {2:.3f}'.format(round(Px,3), round(Py,3), round(r,3)))

if __name__ == '__main__':
    run()

Python: n = int(input())
for i in range(n):
    lst = list(map(float, input().split()))
    a, b = lst[0], lst[1]
    c, d = lst[2], lst[3]
    e, f = lst[4], lst[5]
    
    px = ((a+c)*(a-c)*(b-f)-(a+e)*(a-e)*(b-d)+(b-d)*(b-f)*(d-f))/(2*((a-c)*(b-f)-(a-e)*(b-d)))
    py = ((a-c)*(a-e)*(c-e)+(b+d)*(b-d)*(a-e)-(b+f)*(b-f)*(a-c))/(2*((b-d)*(a-e)-(b-f)*(a-c)))
    r = ((a-px)**2 + (b-py)**2)**0.5


    print('{:.3f}'.format(px), end= " ")
    print('{:.3f}'.format(py), end= " ")
    print('{:.3f}'.format(r))