#include<bits/stdc++.h>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b)) < EPS)

using namespace std;

class Point{
public:
  double x,y,z;

  Point(double x = 0,double y = 0,double z=0): x(x),y(y),z(z){}

  bool operator < (const Point& p) const{ return !equals(x,p.x)?x<p.x:(!equals(y,p.y)&&y<p.y); }

};

typedef Point Vector;

ostream& operator << (ostream& os,const Point& a){ os << "(" << a.x << "," << a.y << ")"; }

double dot(Point a,Point b){ return a.x*b.x + a.y*b.y; }

double cross(Point a,Point b){ return a.x*b.y - a.y*b.x; }

double norm(Point a){ return a.x*a.x+a.y*a.y; }

double abs(Point a){ return sqrt(norm(a)); }

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

struct Event {
  double time;
  int id,id2;
  bool operator < ( const Event &e ) const {
    if( !equals(time,e.time) ) return !equals(time,e.time) && time < e.time; 
    return ( ( id != e.id ) ? id < e.id : id2 < e.id2 );
  }
};

const int MAX_N = 210;
int n;
Point ps[MAX_N],v[MAX_N];
double r[MAX_N],vr[MAX_N];
double coli[MAX_N];

double calc(double x1,double y1,double z1,double vx1,double vy1,double vz1,double r1,double vr1,
            double x2,double y2,double z2,double vx2,double vy2,double vz2,double r2,double vr2){
  double X = x1-x2, VX = vx1 - vx2, Y = y1-y2, VY = vy1-vy2, Z = z1-z2, VZ = vz1-vz2, R = r1+r2, VR = vr1+vr2;
#define pow2(k) ((k)*(k))
  double a = pow2(VX) + pow2(VY) + pow2(VZ) - pow2(VR), b = 2 * ( X*VX + Y*VY + Z*VZ + R*VR ), c = pow2(X) + pow2(Y) + pow2(Z) - pow2(R);
  double D = b * b - 4 * a * c;
  double ret = -1;
  if( LT(D,0.0) ) return ret;

  if( equals(a,0.0) ) {
    if( equals(b,0.0) ) return ret;
    if( LT(-c/b,0.0)  ) return ret;
    ret = - c / b;
    if( LT(0,ret) ) return ret;
    else return -1;
  }

  if( equals(D,0.0) ) D = 0;
  double temp = ( -b - sqrt( D ) ) / ( 2 * a );
  double ret2 = 1e30;
  if( LT(0,temp) ) ret2 = min(ret2,temp);
  temp = ( -b + sqrt( D ) ) / ( 2 * a );
  if( LT(0,temp) ) ret2 = min(ret2,temp);
  if( equals(ret2,1e30) ) ret2 = -1;
  return ret2;

}

void compute(){
  vector<Event> vec;
  rep(i,n) vec.push_back((Event){r[i]/vr[i],i,i});

  rep(i,n) REP(j,i+1,n) {
    double temp = calc(ps[i].x,ps[i].y,ps[i].z,v[i].x,v[i].y,v[i].z,r[i],vr[i],
                       ps[j].x,ps[j].y,ps[j].z,v[j].x,v[j].y,v[j].z,r[j],vr[j]);
    if( !equals(temp,-1) ) vec.push_back((Event){temp,i,j});
  }

  sort(vec.begin(),vec.end());
  rep(i,n) coli[i] = -1;
  int cnt = 0;
  rep(i,vec.size()) {
    if( vec[i].id == vec[i].id2 ) {
      if( equals(coli[vec[i].id],-1) ) coli[vec[i].id] = vec[i].time, ++cnt;
    } else {
      if( !equals(coli[vec[i].id],-1) || !equals(coli[vec[i].id2],-1) ) continue;
      if( equals(coli[vec[i].id ],-1) ) coli[vec[i].id ] = vec[i].time, ++cnt;
      if( equals(coli[vec[i].id2],-1) ) coli[vec[i].id2] = vec[i].time, ++cnt;
    }
    if( cnt >= n ) break;
  }

  rep(i,n) printf("%.10f\n",coli[i]);

}

int main(){
  while( scanf("%d",&n), n ){
    rep(i,n) scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&ps[i].x,&ps[i].y,&ps[i].z,&v[i].x,&v[i].y,&v[i].z,&r[i],&vr[i]);
    compute();
  }
  return 0;
}

Measured memory_bytes: 1924