#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using ld = long double;
constexpr ld eps = 1e-8;

struct S {
  ld p[3];
  ld v[3];
  ld r, vr;
};

vector<ld> solve_quad_eq(ld a, ld b, ld c) {
  vector<ld> res;
  if (abs(a) < eps) {
    res.push_back(-c/b);
    return res;
  }
  ld d = b*b - 4*a*c;
  if (d < -eps) return res;
  if (d < eps) {
    res.push_back(-b/(2*a));
    return res;
  }
  ld p = -b + sqrt(d);
  if (abs(p) < eps) {
    res.push_back(-2*c/(b+sqrt(d)));
  } else {
    res.push_back(p/(2*a));
  }
  ld q = -b - sqrt(d);
  if (abs(q) < eps) {
    res.push_back(-2*c/(b-sqrt(d)));
  } else {
    res.push_back(q/(2*a));
  }
  return res;
}

int main() {
  cout << fixed << setprecision(10);
  while (true) {
    int n;
    cin>>n;
    if(!n) break;
    vector<S> vs;
    using P = pair<int,int>;
    multimap<ld, P> vt;
    REP(i,n) {
      ld px, py, pz, vx, vy, vz, r, vr;
      cin >>px>>py>>pz>>vx>>vy>>vz>>r>>vr;
      vs.push_back({{px,py,pz},{vx,vy,vz},r,vr});
      vt.insert(make_pair(r/vr, make_pair(i, i)));
    }
    REP(i,n)REP(j,i) {
      ld c0 = 0, c1 = 0, c2 = 0;
      REP(k,3) {
        ld a = vs[i].v[k] - vs[j].v[k];
        ld b = vs[i].p[k] - vs[j].p[k];
        c0 += b*b;
        c1 += 2*a*b;
        c2 += a*a;
      }
      ld a = -vs[i].vr + -vs[j].vr;
      ld b = vs[i].r + vs[j].r;
      c0 -= b*b;
      c1 -= 2*a*b;
      c2 -= a*a;
      vector<ld> r = solve_quad_eq(c2, c1, c0);
      for (ld t : r) {
        if (t > 0) {
          vt.insert(make_pair(t, make_pair(i, j)));
        }
      }
    }
    vector<bool> exist(n, true);
    vector<ld> death(n);
    for (const auto &p : vt) {
      ld t = p.first;
      int i, j;
      tie(i, j) = p.second;
      if (exist[i] && exist[j]) {
        death[i] = death[j] = t;
        exist[i] = exist[j] = false;
      }
    }
    for (ld t : death) {
      cout << t << endl;
    }
  }
  return 0;
}