#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const double inf = DBL_MAX;
const int mod = 1e9 + 7;

#define EPS (1e-10)
#define eq(a, b) (fabs((a)-(b)) < EPS)
#define lt(a, b) ((a) - (b) < -EPS)
#define le(a, b) (eq(a, b) || lt(a, b))

struct Point {
  double x, y, z;
  Point(double x=0, double y=0, double z=0):x(x), y(y), z(z){}
  Point operator + (Point p) {
    return Point(x+p.x, y + p.y, z + p.z);
  }
  Point operator - (Point p) {
    return Point(x-p.x, y - p.y, z - p.z);
  }
  Point operator * (double a) {
    return Point(x*a, y*a, z*a);
  }
  Point operator < (const Point& p) const {
    return x != p.x ? x < p.x : y < p.y;
  }
  Point operator == (const Point& p) const {
    return eq(x, p.x) && eq(y, p.y);
  }
};

double norm(Point p) {
  return p.x*p.x + p.y*p.y + p.z*p.z;
}
double abs(Point p) {
  return sqrt(norm(p));
}

struct Star {
  Point p, v;
  double r, vr;
  Star(Point p=Point(), Point v=Point(), double r=0, double vr=0):p(p), v(v), r(r), vr(vr){}
};

int n;
vector<Star> stars;

double distafter(double t, Star s1, Star s2) {
  Point p1 = s1.p + (s1.v*t);
  double r1 = s1.r - s1.vr*t;
  Point p2 = s2.p + (s2.v*t);
  double r2 = s2.r - s2.vr*t;
  return (r1 > 0 && r2 > 0 ? abs(p1-p2) - (r1+r2) : inf);
}

double colli(Star s1, Star s2) {
  bool flag = false;
  double l = 0, r = 111;
  rep(i, 200) {
    /*
    double m = (l + r) / 3;
    double a = l + m, b = r - m;
    */
    double a = l+(r-l)/3, b = l+(r-l)*2/3;
    double d1 = distafter(a, s1, s2);
    double d2 = distafter(b, s1, s2);
    if(d1 == inf || d2 == inf) {
      r = b;
      continue;
    }
    if(d1 <= 0) flag = true;
    if(d1 < d2) r = b;
    else l = a;
  }
  return (flag ? l : -1);
}

double timebefor(double tm, Star s1, Star s2) {
  double l = 0, r = tm;
  rep(i, 200) {
    double m = (l + r) / 2;
    double d = distafter(m, s1, s2);
    if(d <= 0) r = m;
    else l = m;
  }
  return r;
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  while(cin >> n, n) {
    stars.clear();
    rep(i, n) {
      Point p, v;
      double r, vr;
      cin >> p.x >> p.y >> p.z >> v.x >> v.y >> v.z >> r >> vr;
      stars.emplace_back(p, v, r, vr);
    }
    vector< tuple<double, int, int> > dis;
    rep(i, n) {
      dis.emplace_back(stars[i].r/stars[i].vr, i, i);
      reps(j, i+1, n) {
	double tm = colli(stars[i], stars[j]);
	if(tm == -1) continue;
	double t = timebefor(tm, stars[i], stars[j]);
        dis.emplace_back(t, i, j);
      }
    }
    sort(all(dis));
    vector<double> ans(n, -1);
    for(auto data : dis) {
      double t;
      int i, j;
      tie(t, i, j) = data;
      if(ans[i] < 0 && ans[j] < 0) ans[i] = t, ans[j] = t;
    }
    for(double t : ans) cout << t << endl;
  }

  return 0;
}

Measured memory_bytes: 3312