#include <iostream>
#include <string>
#include <vector>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <algorithm>

using namespace std;

using ld = long double;
using ld3 = tuple<ld, ld, ld>;
using star = tuple<ld3, ld3, ld, ld>;

int main(){
  int n;
  
    std::cout << fixed << std::setprecision(30);
  while(cin >> n, n != 0) {
    vector<ld> px(n), py(n), pz(n), vx(n), vy(n), vz(n), r(n), vr(n);
    vector<star> stars(n);
    for(int i = 0; i < n; i++){
      cin >> px[i] >> py[i] >> pz[i] >> vx[i] >> vy[i] >> vz[i] >> r[i] >> vr[i];
      stars[i] = make_tuple(
        make_tuple(px[i], py[i], pz[i]),
        make_tuple(vx[i], vy[i], vz[i]),
        r[i], vr[i]
      );
    }
    auto sub = [&](ld3 x, ld3 y) {
      ld px, py, pz, vx, vy, vz;
      tie(px, py, pz) = x;
      tie(vx, vy, vz) = y;
      return make_tuple(px - vx, py - vy, pz -vz);
    };
    auto pos = [&](star x, ld t) {
      ld px, py, pz, vx, vy, vz;
      tie(px, py, pz) = get<0>(x);
      tie(vx, vy, vz) = get<1>(x);
      return make_tuple(px + t*vx, py + t*vy, pz + t*vz);
    };
    auto dis2 = [&](ld3 x, ld3 y) {
      ld px, py, pz, vx, vy, vz;
      tie(px, py, pz) = x;
      tie(vx, vy, vz) = y;
      return (px - vx)*(px - vx) + (py - vy)*(py- vy) + (pz -vz)*(pz-vz);
    };
    auto ssize = [&](star x, ld t) {
      return get<2>(x) + get<3>(x) * t;
    };
    auto cod = [&](star x, star y, ld time){
      auto xp = pos(x, time);
      auto yp = pos(y, time);
      auto d = dis2(xp, yp);
      auto sd = ssize(x, time) + ssize(y, time);
      if (d < sd) {
        return true;
      } else {
        return false;
      }
    };
    auto muladd = [&](ld3 x, ld3 y) {
      ld px, py, pz, vx, vy, vz;
      tie(px, py, pz) = x;
      tie(vx, vy, vz) = y;
      return px * vx + py * vy + pz * vz;
    };
    const ld eps = 1e-80;
    auto ct = [&](star x, star y) {
      auto xp = get<0>(x), yp = get<0>(y), xv = get<1>(x), yv = get<1>(y);
      auto xs = get<2>(x), ys = get<2>(y), xl = get<3>(x), yl = get<3>(y); 
      auto pa = dis2(xv, yv) - (xl+yl)*(xl+yl);
      auto pb = +muladd(sub(xp, yp), sub(xv, yv)) + (xs+ys)*(xl+yl);
      auto pc = dis2(xp, yp) - (xs+ys)*(xs+ys);
 
      auto db = [&](ld k){return k*k;};
      //cout <<"#"<<muladd(sub(xp, yp), sub(xv, yv))<<"-"<<(xs+ys)*(xl+yl)<<endl;
      //cout << pa <<","<< pb <<","<< pc <<endl;
      //pa = db(xv - yv) - db(xs+ys);
      //pb = (xv-yv)*(xp-yp) + (xs+ys)*(xl+yl);
      //pc = db(xp - yp) - db(xl+yl)
      //cout << pa <<","<< pb <<","<< pc <<endl;
      
        if (pb*pb - pa*pc < 0){
           return vector<ld>{};
      }
      auto a1 = (-pb+sqrt(pb*pb - pa*pc))/pa;
      auto a2 = (-pb-sqrt(pb*pb - pa*pc))/pa;
      return vector<ld>{a1, a2};
    };
    vector<tuple<ld, int, int>> ev;
    for (int i = 0; i < n; i++){
      for (int k = 0; k < i; k++){
        for (auto d : ct(stars[i], stars[k])){
          if (d >= 0){
            ev.emplace_back(d, i, k);
          }
        }
      } 
    }
    for (int i = 0; i < n; i++){
      auto s = stars[i];
      ev.emplace_back(get<2>(s) / get<3>(s), -1, i);
    }
    sort(ev.begin(), ev.end());
    vector<bool> del(n, false);
    vector<ld> dt(n);
    for (auto& c : ev){
      ld f; int j, k; tie(f, j, k) = c;
      if (j==-1 && !del[k]) {
        dt[k] = f; del[k] = true;
      }
      if(j>=0 && !del[j] && !del[k])
      {dt[j] = f; del[j]=true; dt[k] = f; del[k] = true;}
      //cout << f << "->" << j << "," << k << endl;
    }
    for (auto& c: dt){
      cout << c << endl;
    }
    // |(p + vt) - (q + wt)|^2 = ((r - xt) + (s - yt))^2
    // |(p-q) + (v-w)t|^2  +(x+y)t - (r+s)
    // (pqx + vwxt)*(pqx + vwxt) = pqx^2 + 2pqx vwx t + vwx^2 t^2
    // (vwx^2+vwy^2+vw^2 - (x+y)^2) t^2 + (2pqx vwx + 2pqy vwy + 2pqz vwz + 2(r+s)(x+y)) t +(pqx^2+^2+^2-(r+s)^2)
    // x = (-b+-sqrt(b^2-4ac)/2a)
    // 0 10 2 -2 4 1 4 1  => |2-8| - 3 - 3
    // a=4^2-2^2=12 b=80+2 c=100-8
    // (10-4t)^2 - 8 + 2t = 92-
    // 15 -20 4 2
    // (20^2-2^2) 2*(-15*20+4*2) (15^2-4^2)
  }   
}


Measured memory_bytes: 4928