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: # -*- coding: utf-8 -*-

import cmath

class Point(object):
    def __init__(self, x, y):
        self.point = complex(x, y)
    def __str__(self):
        return "x = {0}, y = {1}".format(self.point.real, self.point.imag)

class Triangle(Point):
    def __init__(self, a, b, c):
        self.a = a
        self.b = b
        self.c = c
        # ３辺の長さ
        self.edgeA = abs(b.point-c.point)
        self.edgeB = abs(c.point-a.point)
        self.edgeC = abs(a.point-b.point)
        # ３角の大きさ
        self.angleA = Triangle.angle(self.edgeA, self.edgeB, self.edgeC)
        self.angleB = Triangle.angle(self.edgeB, self.edgeC, self.edgeA)
        self.angleC = Triangle.angle(self.edgeC, self.edgeA, self.edgeB)

    # 角度を求める
    def angle(A, B, C):
        return cmath.acos( (B*B+C*C-A*A)/(2*B*C) )


    # 外接円の半径
    def circumscribedCircleRadius(self):
        return abs((self.edgeA/cmath.sin(self.angleA))/2)

    # 外心
    def circumscribedCircleCenter(self):
        A = cmath.sin(2*self.angleA)
        B = cmath.sin(2*self.angleB)
        C = cmath.sin(2*self.angleC)
        X = (self.a.point.real*A + self.b.point.real*B + self.c.point.real*C) / (A+B+C)
        Y = (self.a.point.imag*A + self.b.point.imag*B + self.c.point.imag*C) / (A+B+C)
        return complex(X, Y)

n = int(input())
for i in range(n):
    line = list(map(float, input().split()))
    p1 = Point(line[0], line[1])
    p2 = Point(line[2], line[3])
    p3 = Point(line[4], line[5])
    T = Triangle(p1, p2, p3)
    center = T.circumscribedCircleCenter()
    print("{0:.3f} {1:.3f} {2:.3f}".format(center.real, center.imag, T.circumscribedCircleRadius()))

Python: import sys
f = sys.stdin

def take2(iterable):
    while True:
        yield next(iterable), next(iterable)
#外積
def cross(v1, v2):
    return v1.real * v2.imag - v1.imag * v2.real
# 線分13と線分24の交点を求める
def get_intersection(p1,p2,p3,p4):
    a1 = p4 - p2
    b1 = p2 - p3
    b2 = p1 - p2
    s1 = cross(a1, b2) / 2
    s2 = cross(a1, b1) / 2
    return p1 + (p3 - p1) * s1 / (s1 + s2)

n = int(f.readline())
for i in range(n):
    p1, p2, p3 = [x + y * 1j for x, y in take2(map(float, f.readline().split()))]
    p12 = (p1 + p2) / 2
    p13 = (p1 + p3) / 2
    pxy = get_intersection(p12,p13,p12 + (p2 - p1) * 1j,p13 + (p1 - p3) * 1j)
    r = abs(pxy - p1)
    print('{:.3f} {:.3f} {:.3f}'.format(pxy.real,pxy.imag,r))

Python: import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

def distance(x1, y1, x2, y2):
    return math.sqrt((x1-x2)**2 + (y1-y2)**2)

def intersection(a1, a2, b1, b2):
    x1,y1 = a1
    x2,y2 = a2
    x3,y3 = b1
    x4,y4 = b2

    ksi = (y4 - y3) * (x4 - x1) - (x4 - x3) * (y4 - y1)
    eta = (x2 - x1) * (y4 - y1) - (y2 - y1) * (x4 - x1)
    delta = (x2 - x1) * (y4 - y3) - (y2 - y1) * (x4 - x3)
    if delta == 0:
        return None
    ramda = ksi / delta;
    mu = eta / delta;
    if ramda >= 0 and ramda <= 1 and mu >= 0 and mu <= 1:
        return (x1 + ramda * (x2 - x1), y1 + ramda * (y2 - y1))

    return None

def circumcenters(a,b,c):
    t1 = [(a[0]+b[0])/2, (a[1]+b[1])/2]
    s1 = [t1[1]-a[1], a[0]-t1[0]]
    t2 = [(a[0]+c[0])/2, (a[1]+c[1])/2]
    s2 = [t2[1]-a[1], a[0]-t2[0]]
    p1 = [t1[0]+s1[0]*1e7, t1[1]+s1[1]*1e7]
    p2 = [t1[0]-s1[0]*1e7, t1[1]-s1[1]*1e7]
    p3 = [t2[0]+s2[0]*1e7, t2[1]+s2[1]*1e7]
    p4 = [t2[0]-s2[0]*1e7, t2[1]-s2[1]*1e7]
    return intersection(p1,p2,p3,p4)

def main():
    n = I()
    rr = []
    for _ in range(n):
        x1,y1,x2,y2,x3,y3 = LF()
        a = [x1,y1]
        b = [x2,y2]
        c = [x3,y3]
        t = circumcenters(a,b,c)
        rr.append('{:0.3f} {:0.3f} {:0.3f}'.format(t[0], t[1], distance(t[0],t[1],x1,y1)))

    return '\n'.join(rr)


print(main())

Python: import math
N = int(input())
for i in range(N):
	x1,y1,x2,y2,x3,y3 = map(float,input().split())
	
	x =((y1-y3)*(y1*y1 -y2*y2 +x1*x1 -x2*x2) -(y1-y2)*(y1*y1 -y3*y3 +x1*x1 -x3*x3)) / (2*((y1-y3)*(x1-x2)-(y1-y2)*(x1-x3)))
	y =((x1-x3)*(x1*x1 -x2*x2 +y1*y1 -y2*y2) -(x1-x2)*(x1*x1 -x3*x3 +y1*y1 -y3*y3)) / (2*((x1-x3)*(y1-y2)-(x1-x2)*(y1-y3)))
	r = (x-x1)*(x-x1)+(y-y1)*(y-y1)
	print("{0:.3f} {1:.3f} {2:.3f}".format(x,y,math.sqrt(r)))

Python: from math import sqrt
n = int(input())

for i in range(n):
    l = input()
    x1,y1,x2,y2,x3,y3=map(float,l.split(' '))
    a_2 = (x1 - x2)**2 + (y1 - y2)**2
    b_2 = (x2 - x3)**2 + (y2 - y3)**2
    c_2 = (x3 - x1)**2 + (y3 - y1)**2
    cos_a_2 = (b_2 + c_2 - a_2)**2/(4* b_2 * c_2)
    sin_a_2 = 1 - cos_a_2
    r = round(sqrt(a_2/sin_a_2)/2,3)
    a = (x1**2 - x3**2 + y1**2 - y3**2)*(x2 - x1)
    b = (x1**2 - x2**2 + y1**2 - y2**2)*(x3 - x1)
    c = (y2 - y1)*(x3 - x1)
    d = (y3 - y1)*(x2 - x1)
    py = round((a-b)/(c-d)/2,3) + 0
    a = (x1**2 - x3**2 + y1**2 - y3**2)*(y2 - y1)
    b = (x1**2 - x2**2 + y1**2 - y2**2)*(y3 - y1)
    c = (x2 - x1)*(y3 - y1)
    d = (x3 - x1)*(y2 - y1)
    px = round((a-b)/(c-d)/2,3) + 0
    print('%.3f %.3f %.3f' %(px, py, r))

Python: import sys

def take2(iterable):
    while True:
        yield next(iterable), next(iterable)
#外積
def cross(v1, v2):
    return v1.real * v2.imag - v1.imag * v2.real
# 線分13と線分24の交点を求める
def get_intersection(p1,p2,p3,p4):
    a1 = p4 - p2
    b1 = p2 - p3
    b2 = p1 - p2
    s1 = cross(a1, b2) / 2
    s2 = cross(a1, b1) / 2
    return p1 + (p3 - p1) * s1 / (s1 + s2)

n = int(f.readline())
for i in range(n):
    p1, p2, p3 = [x + y * 1j for x, y in take2(map(float, f.readline().split()))]
    p12 = (p1 + p2) / 2
    p13 = (p1 + p3) / 2
    pxy = get_intersection(p12,p13,p12 + (p2 - p1) * 1j,p13 + (p1 - p3) * 1j)
    r = abs(pxy - p1)
    print('{:.3f} {:.3f} {:.3f}'.format(pxy.real,pxy.imag,r))

Python: import math
for _ in[0]*int(input()):
 a,b,c,d,e,f=map(float,input().split())
 s,t,u=a*a+b*b,c*c+d*d,e*e+f*f
 x=(s*(d-f)+t*(f-b)+u*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
 y=(s*(c-e)+t*(e-a)+u*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
 print('%.3f %.3f %.3f'%(x,y,math.hypot(x-a,y-b)))

Python: from math import sqrt
n = int(input())
for i in range(n):
    x1,y1,x2,y2,x3,y3 = list(map(float, input().split()))
    c = 2*((x2 - x1)*(y3 - y1) - (y2 - y1)*(x3 - x1))
    ox = ((y3 - y1)*(x2**2 - x1**2 + y2**2 - y1**2) + (y1 - y2)*(x3**2 - x1**2 + y3**2 - y1**2))/c
    oy = ((x1 - x3)*(x2**2 - x1**2 + y2**2 - y1**2) + (x2 - x1)*(x3**2 - x1**2 + y3**2 - y1**2))/c
    r = sqrt((x1-ox)**2+(y1-oy)**2)
    print("{0:.3f} {1:.3f} {2:.3f}".format(ox+0.0, oy+0.0, r+0.0))