#include <bits/stdc++.h>

using namespace std;

namespace {
    typedef long double real;

    const real EPS =1e-8;

    struct Point {
        real x, y, z;
        Point() : x(0), y(0), z(0) {}
        Point(real x, real y, real z) : x(x), y(y), z(z) {}
    };
    istream& operator>>(istream& is, Point& a) { return is >> a.x >> a.y >> a.z; }
    ostream& operator<<(ostream& os, const Point& a) { return os << "Point(" << a.x << "," << a.y << "," << a.z << ")"; }
    Point operator+(const Point& a, const Point& b) { return Point(a.x + b.x, a.y + b.y, a.z + b.z); }
    Point operator-(const Point& a, const Point& b) { return Point(a.x - b.x, a.y - b.y, a.z - b.z); }
    Point operator*(const Point& a, real k) { return Point(a.x * k, a.y * k, a.z * k); }
    Point operator/(const Point& a, real k) { return a * (1.0 / k); }

    const real INF = 1e9;

    int N;
    vector<Point> P, V;
    vector<real> R, VR;
    bool input() {
        cin >> N;
        if (N == 0) return false;
        P.resize(N); V.resize(N);
        R.resize(N); VR.resize(N);
        for (int i = 0; i < N; i++) {
            cin >> P[i] >> V[i] >> R[i] >> VR[i];
        }
        return true;
    }

    real dist(Point a, Point b) {
        real dx = a.x - b.x,
             dy = a.y - b.y,
             dz = a.z - b.z;
        return sqrt(dx * dx + dy * dy + dz * dz);
    }

    bool C(real t, int i, int j) {
        if (t < 0) return false;
        Point v = V[i] - V[j];
        Point p = P[i], q = P[j];
        return dist(p + v * t, q) + VR[i] * t + VR[j] * t < R[i] + R[j] + EPS;
    }

    bool EQ(real a, real b) { return abs(a - b) < EPS; }

    real SQ(real x) { return x * x; }

    vector<real> T; // 自然消滅時刻
    real clash_time(int i, int j) {
        Point v = V[i] - V[j];
        real a = SQ(VR[i] + VR[j]) - SQ(v.x) - SQ(v.y) - SQ(v.z);
        real b = - 2 * ( (R[i] + R[j]) * (VR[i] + VR[j]) 
                + v.x * (P[i].x - P[j].x) + v.y * (P[i].y - P[j].y) + v.z * (P[i].z - P[j].z) );
        real c = SQ(R[i] + R[j]) - SQ(P[i].x - P[j].x) - SQ(P[i].y - P[j].y) - SQ(P[i].z - P[j].z);
        real t0 = (-b + sqrt(b * b - 4 * a * c)) / (2.0 * a);
        real t1 = (-b - sqrt(b * b - 4 * a * c)) / (2.0 * a);
        if (false) {
            cout << i << " " << j << " " << t0 << " " << t1 << endl;
            cout << a << " " << b << " " << c << endl;
        }
        if (!C(t0, i, j) && !C(t1, i, j)) return INF;
        if (!C(t0, i, j)) return t1;
        if (!C(t1, i, j)) return t0;
        return min(t0, t1);
    }

    template<class T> ostream& operator<<(ostream& os, const vector<T>& vs) {
        if (vs.empty()) return os << "[]";
        os << "[" << vs[0];
        for (int i = 1; i < vs.size(); i++) os << " " << vs[i];
        return os << "]";
    }

    struct E {
        int a, b;
        real t;
        E(int a, int b, real t) : a(a), b(b), t(t) {}
        bool operator<(const E& e) const {
            return t > e.t;
        }
    };

    void solve() {
        T.resize(N);
        for (int i = 0; i < N; i++) {
            T[i] = R[i] / VR[i];
        }

        priority_queue<E> PQ;
        for (int i = 0; i < N - 1; i++) {
            for (int j = i + 1; j < N; j++) {
                real t = clash_time(i, j);
                PQ.push(E(i, j, t));
            }
        }
        while (!PQ.empty()) {
            E e = PQ.top(); PQ.pop();
            if (T[e.a] < e.t || T[e.b] < e.t) continue;
            T[e.a] = T[e.b] = e.t;
        }
        for (int i = 0; i < N; i++) {
            printf("%.12Lf\n", T[i]);
        }
    }
}

int main() {
    while (input()) solve();
    return 0;
}

Measured memory_bytes: 2788