#include <bits/stdc++.h>
using namespace std;

typedef long double ldouble;

const int N = 200;
const ldouble EPS = 1e-10;
const ldouble INF = 1e+12;

struct P3{
  ldouble x,y,z;
  P3(ldouble x=0, ldouble y=0, ldouble z=0):x(x),y(y),z(z){}
  P3 operator + (const P3 &a) const{ return (P3){x+a.x, y+a.y, z+a.z}; }
  P3 operator - (const P3 &a) const{ return (P3){x-a.x, y-a.y, z-a.z}; }
  P3 operator * (const ldouble &c) const{ return (P3){x*c, y*c, z*c}; }

  void print(){
    printf("(%.5Lf, %.5Lf, %.5Lf)",x,y,z);
  }
};

struct L3{
  P3 a,b;
  L3(P3 a=P3(0,0), P3 b=P3(0,0)):a(a),b(b){}
};

struct Sphere{
  P3 c;
  ldouble r;
  Sphere(P3 c, ldouble r):c(c),r(r){}
};

struct data{
  Sphere s;
  P3 v;
  ldouble vr;
  data(P3 p, P3 v, ldouble r, ldouble vr):s(Sphere(p,r)),v(v),vr(vr){}

  Sphere getS(ldouble t){
    return Sphere(P3(s.c.x + t*v.x, s.c.y + t*v.y, s.c.z + t*v.z), s.r - t*vr);
  }
};

struct dat2{
  int n1,n2;
  ldouble t;
  dat2(int n1=0, int n2=0, ldouble t=0):n1(n1),n2(n2),t(t){}
  bool operator < (const dat2 &d) const {
    return t < d.t;
  }
};

bool equal(ldouble a, ldouble b){return fabs(a-b) < EPS;}

ldouble abs(P3 a){ return sqrt(a.x*a.x + a.y*a.y + a.z*a.z); }

ldouble dot(P3 a, P3 b){ return a.x*b.x + a.y*b.y + a.z*b.z; }

ldouble distSP(L3 S, P3 p){
  ldouble a = dot(S.b - S.a, S.b - S.a);
  ldouble b = dot(S.b - S.a, S.a - p);
  ldouble c = dot(S.a - p, S.a - p);
  ldouble t = -b / a;
  if(t < -EPS) return abs(S.a - p);
  if(t > 1 + EPS) return abs(S.b - p);
  return a * t * t + 2 * b * t + c;
}

ldouble distPP(P3 a, P3 b){ return abs(a-b);}

ldouble distSS(L3 S1, L3 S2){
  // a*s + b*t = e
  // c*s + d*t = f
  P3 v1 = S1.b - S1.a, v2 = S2.b - S2.a, v3 = S1.a - S2.a;
  ldouble a = dot(v1, v1);
  ldouble b = -dot(v1, v2);
  ldouble c = -dot(v1, v2);
  ldouble d = dot(v2, v2);
  ldouble e = -dot(v1, v3);
  ldouble f = dot(v2, v3);
  
  ldouble ans = INF;
  ans = min(ans, distSP(S1, S2.a));
  ans = min(ans, distSP(S1, S2.b));
  ans = min(ans, distSP(S2, S1.a));
  ans = min(ans, distSP(S2, S1.b));

  ldouble det = a * d - b * c;
  if(det != 0){
    ldouble s = (d * e - b * f) / det;
    ldouble t = (-c * e + a * f) / det;
    if(0 <= s && s <= 1 && 0 <= t && t <= 1)
      ans = min(ans, distPP(S1.a + v1*s, S2.a + v2*t));
  }
  return ans + EPS;
}


int n;
vector<data> v;

ldouble calc_maxdis(int a, int b, ldouble t){
  return distSS(L3(v[a].s.c, v[a].getS(t).c), L3(v[b].s.c, v[b].getS(t).c));
}

//????????????????????¢
ldouble calc(int a, int b, ldouble t){
  return abs(v[a].getS(t).c - v[b].getS(t).c);
}

//????????????????????¢
ldouble calc2(int a, int b, ldouble t){
  return calc(a, b, t) - (v[a].getS(t).r + v[b].getS(t).r);
}

void solve(){
  vector<dat2> vd;
  ldouble ans[N];

  for(int i=0;i<n;i++){
    vd.push_back(dat2(i, i, v[i].s.r / v[i].vr));
  }

  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      ldouble le = 0.0, ri = min(v[i].s.r/v[i].vr, v[j].s.r/v[j].vr), midl, midr, res[3], t, mid;
      //??????????????????????????????????????????????±???????
      while(fabs(le-ri) > EPS){
        midl = (le * 2.0 + ri) / 3.0;
        midr = (le + ri * 2.0) / 3.0;
        res[0] = calc(i, j, le);
        res[1] = calc(i, j, midl);
        res[2] = calc(i, j, midr);
        if(res[0] > res[1] - EPS && res[1] > res[2] - EPS) le = midl;
        else ri = midr;
      }
      t = (le + ri) / 2.0;
      
      //?§????????????????????????§??????????????¢????????¢??°???????????¨?????£????????§??????????\??°????????±???????
      le = 0, ri = t;
      while(fabs(le-ri) > EPS){
        midl = (le * 2.0 + ri) / 3.0;
        midr = (le + ri * 2.0) / 3.0;
        res[0] = calc2(i, j, le);
        res[1] = calc2(i, j, midl);
        res[2] = calc2(i, j, midr);
        if(res[0] > res[1] - EPS && res[1] > res[2] - EPS) le = midl;
        else ri = midr;
      }
      t = (le + ri) / 2.0;
      
      if(calc2(i, j, t) > EPS) continue;

      //?\??°???????EPS(0)??\???????????£??????????????§????????¢0???????????????????±???????
      le = 0, ri = t;
      while(fabs(le - ri) > EPS){
        mid = (le + ri) / 2.0;
        if(calc2(i, j, mid) > EPS) le = mid;
        else ri = mid;
      }
      t = (le + ri) / 2.0;
      
      vd.push_back(dat2(i, j, t));
    }
  }


  bool f[N];
  fill(f,f+N,false);
  sort(vd.begin(), vd.end());
  for(int i=0;i<vd.size();i++){
    if(!f[vd[i].n1] && !f[vd[i].n2]){
      //if(n < 27) cout << "> " << vd[i].n1 << ' ' << vd[i].n2 << ' ' << vd[i].t << endl;
      f[vd[i].n1] = true;
      f[vd[i].n2] = true;
      ans[vd[i].n1] = vd[i].t;
      ans[vd[i].n2] = vd[i].t;
    }
  }

  for(int i=0;i<n;i++) printf("%.10Lf\n",ans[i]);
}

int main(){
  while(cin >> n && n){
    v.clear();
    for(int i=0;i<n;i++){
      ldouble x,y,z,vx,vy,vz,r,vr;
      cin >> x >> y >> z >> vx >> vy >> vz >> r >> vr;
      v.push_back(data(P3(x,y,z),P3(vx,vy,vz),r,vr));
    }
    solve();
  }
}

Measured memory_bytes: 1352