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

typedef double D;
typedef tuple<D, D> P2;
typedef tuple<D, D, D> P3;

namespace std {
    P2 operator+(const P2 &a, const P2 &b) {
        D ax, ay, bx, by;
        tie(ax, ay) = a;
        tie(bx, by) = b;
        return P2{ax + bx, ay + by};
    }
    P2 operator*(const P2 &a, const P2 &b) {
        D ax, ay, bx, by;
        tie(ax, ay) = a;
        tie(bx, by) = b;
        return P2{ax * bx, ay * by};
    }
    P3 operator-(const P3 &a, const P3 &b) {
        D ax, ay, az, bx, by, bz;
        tie(ax, ay, az) = a;
        tie(bx, by, bz) = b;
        return P3{ax - bx, ay - by, az - bz};
    }
    P3 operator*(const P3 &a, const P3 &b) {
        D ax, ay, az, bx, by, bz;
        tie(ax, ay, az) = a;
        tie(bx, by, bz) = b;
        return P3{ax * bx, ay * by, az * bz};
    }
}

double sum_elem(const P3 &p) {
    D x, y, z;
    tie(x, y, z) = p;
    return x + y + z;
}

int main() {
    int n;
    while(cin >> n, n) {
        vector<P3> p(n), v(n);
        vector<P2> r(n);
        vector<tuple<D, int, int>> time_step(n);
        for (int i = 0; i < n; i++) {
            double px, py, pz, vx, vy, vz, pr, vr;
            cin >> px >> py >> pz >> vx >> vy >> vz >> pr >> vr;
            p[i] = P3{px, py, pz};
            v[i] = P3{vx, vy, vz};
            r[i] = P2{pr, vr};
            time_step[i] = make_tuple(pr/vr, i, -1);
        }

        for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) {
            // dist = (pd + t * vd)^2 = vd*vd t^2 + 2 * pd * vd t + pd * pd
            auto pd = p[i] - p[j], vd = v[i] - v[j];
            auto PA = sum_elem(vd * vd), PB = 2 * sum_elem(vd * pd), PC = sum_elem(pd * pd);

            D dr, vdr; tie(dr, vdr) = r[i] + r[j];
            D RA = vdr * vdr, RB = -2 * dr * vdr, RC = dr * dr;

            D A = PA - RA, B = PB - RB, C = PC - RC;
            if (A < 1e-8) continue;
            D root = sqrt(B * B - 4 * A * C);
            auto t1 = (-B + root) / (2 * A), t2 = (-B - root) / (2 * A);
            if (t1 > 0)
                time_step.push_back(make_tuple(t1, i, j));
            if (t2 > 0)
                time_step.push_back(make_tuple(t2, i, j));
        }

        sort(time_step.begin(), time_step.end());
        vector<D> ans(n, -1);
        for (auto step : time_step) {
            D time;
            int s1, s2;
            tie(time, s1, s2) = step;
            if (ans[s1] < 0 && (s2 < 0 || ans[s2] < 0)) {
                ans[s1] = time;
                if (s2 >= 0) ans[s2] = time;
            }
        }

        for (auto time : ans) {
            printf("%.10lf\n", time);
        }
    }
}

