Problem:
Problem H: Super Star

During a voyage of the starship Hakodate-maru (see Problem A), researchers found strange synchronized movements of stars. Having heard these observations, Dr. Extreme proposed a theory of "super stars". Do not take this term as a description of actors or singers. It is a revolutionary theory in astronomy.

According to this theory, stars we are observing are not independent objects, but only small portions of larger objects called super stars. A super star is filled with invisible (or transparent) material, and only a number of points inside or on its surface shine. These points are observed as stars by us.

In order to verify this theory, Dr. Extreme wants to build motion equations of super stars and to compare the solutions of these equations with observed movements of stars. As the first step, he assumes that a super star is sphere-shaped, and has the smallest possible radius such that the sphere contains all given stars in or on it. This assumption makes it possible to estimate the volume of a super star, and thus its mass (the density of the invisible material is known).

You are asked to help Dr. Extreme by writing a program which, given the locations of a number of stars, finds the smallest sphere containing all of them in or on it. In this computation, you should ignore the sizes of stars. In other words, a star should be regarded as a point. You may assume the universe is a Euclidean space.

Input

The input consists of multiple data sets. Each data set is given in the following format.

n
x1 y1 z1
x2 y2 z2
...
xn yn zn

The first line of a data set contains an integer n, which is the number of points. It satisfies the condition 4 ≤ n ≤ 30.

The locations of n points are given by three-dimensional orthogonal coordinates: (xi, yi, zi) (i = 1,..., n). Three coordinates of a point appear in a line, separated by a space character.

Each value is given by a decimal fraction, and is between 0.0 and 100.0 (both ends inclusive). Points are at least 0.01 distant from each other.

The end of the input is indicated by a line containing a zero.

Output

For each data set, the radius ofthe smallest sphere containing all given points should be printed, each in a separate line. The printed values should have 5 digits after the decimal point. They may not have an error greater than 0.00001.

Sample Input

4
10.00000 10.00000 10.00000
20.00000 10.00000 10.00000
20.00000 20.00000 10.00000
10.00000 20.00000 10.00000
4
10.00000 10.00000 10.00000
10.00000 50.00000 50.00000
50.00000 10.00000 50.00000
50.00000 50.00000 10.00000
0

Output for the Sample Input

7.07107
34.64102

Solution in C++ (judge verdict: Wrong Answer)

#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
#include <complex>
#include <assert.h>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;

class Point {
public:
  double _x;
  double _y;
  double _z;
  Point (double x,double y,double z) :
    _x(x), _y(y), _z(z) {}
  Point operator-(const Point& p) const {
    return Point(_x - p._x,
                 _y - p._y,
                 _z - p._z);
  }
  Point operator+(const Point& p) const {
    return Point(_x + p._x,
                 _y + p._y,
                 _z + p._z);
  }
  void operator+=(const Point& p) const {
    _x + p._x;
    _y + p._y;
    _z + p._z;
  }
  Point operator*(const double t) const {
    return Point(_x * t,
                 _y * t,
                 _z * t);
  }
  Point operator*(const Point&p) const {
    return Point(_x * p._x,
                 _y * p._y,
                 _z * p._z);
  }
  Point operator/(const double t) const {
    return Point(_x / t,
                 _y / t,
                 _z / t);
  }
  void operator/=(const double t) {
    _x /= t;
    _y /= t;
    _z /= t;
  }
  void print_vec() const{
    printf("(%lf,%lf,%lf)\n",_x,_y,_z);
  }
};

class Line : public vector<Point> {
public:
  Line(const Point& p1,const Point& p2) {
    push_back(p1);
    push_back(p2);
  }
};

double norm(const Point& p){
  return sqrt(p._x * p._x + p._y * p._y + p._z * p._z);
}

Point unit(const Point& p){
  return p/norm(p);
}

double dot(const Point& p1,const Point& p2){
  return p1._x * p2._x + p1._y * p2._y + p1._z * p2._z;
}

Point cross(const Point& p1,const Point& p2){
  return Point(p1._y * p2._z - p1._z * p2._y,
               p1._z * p2._x - p1._x * p2._z,
               p1._x * p2._y - p1._y * p2._x);
}

Point projection(const Line& l,const Point& p){
  double t = dot(p - l[0],l[0]-l[1]) / norm(l[0] - l[1]);
  return l[0] + unit(l[0] - l[1]) * t;
}

bool EQ(const Point& s,const Point& t) {
  if((t._x - EPS <= s._x && s._x <= t._x + EPS)
     && (t._y - EPS <= s._y && s._y <= t._y + EPS)
     && (t._z - EPS <= s._z && s._z <= t._z + EPS)) return true;
  return false;
}

bool parallelLL(const Line &l, const Line &m) {
  return EQ(cross(l[1]-l[0], m[1]-m[0]),Point(0,0,0));
}

bool intersectLP(const Line &l, const Point &p) {
  return (norm(cross(l[1]-p, l[0]-p)) < EPS);
}

double distanceLP(const Line& l,const Point& p){
  if(intersectLP(l,p)) return 0;
  return norm(p - projection(l,p));
}

double distanceLL(const Line& l,const Line& m){
  if(parallelLL(l,m)) return distanceLP(l,m[0]);

  const Point V1 = l[1] - l[0];
  const Point V2 = m[1] - m[0];
  const Point V3 = m[0] - l[0];
  return abs(dot(cross(V1,V2),V3)/norm(cross(V1,V2)));
}

double distancePP(const Point& s,const Point& t) {
  if(EQ(s,t)) return 0;
  return norm(Point(s._x - t._x,s._y - t._y,s._z - t._z));
}

const int sign[8][3] = {
  {+1,+1,+1},
  {+1,+1,-1},
  {+1,-1,+1},
  {+1,-1,-1},
  {-1,+1,+1},
  {-1,+1,-1},
  {-1,-1,+1},
  {-1,-1,-1}
};

int main(){
  int num_of_stars;
  while(~scanf("%d",&num_of_stars)){
    if(num_of_stars == 0) break;

    vector<Point> stars;
    Point center(0,0,0);
    for(int star_i = 0; star_i < num_of_stars; star_i++){
      double x,y,z;
      scanf("%lf %lf %lf",&x,&y,&z);
      stars.push_back(Point(x,y,z));
    }

    vector<Point> candidates;
    candidates.push_back(Point(50.0,50.0,50.0));
    double min_radius = 1e15;

    double size = 100.0;

    while(size > 0.000002){
      size = size / 2.0;

      vector<Point> next;      
      for(int candidate_i=0;candidate_i < candidates.size(); candidate_i++){
        for(int sign_i = 0; sign_i < 8; sign_i++){
          Point p = candidates[candidate_i];
          p._x += sign[sign_i][0] * size / 2.0;
          p._y += sign[sign_i][1] * size / 2.0;
          p._z += sign[sign_i][2] * size / 2.0;

          double r = 0.0;
          for(int star_i = 0; star_i < stars.size(); star_i++){
            r = max(r,distancePP(candidates[candidate_i],stars[star_i]));
          }

          if(r < min_radius){
            min_radius = r;
          }
          if(min_radius <= r - sqrt(3.0) * size / 2.0){
            continue;
          }
          if(next.size() < 10000) next.push_back(p);
        }
      }
      candidates = next;
    }

    printf("%.5lf\n",min_radius);
  }
}