#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
typedef tuple<double, int, int> T;

double sq(double x) { return x * x; }
const double EPS = 1e-8;

vector<double> quadratic(double a, double b, double c){
    if(abs(a) < EPS){
        // bx + c = 0
        if(abs(b) < EPS){
            // c = 0 のとき任意のxが解．c != 0 のとき解なし．
            return vector<double>();
        }
        return vector<double>(1, -c / b);
    }
    double D = b*b - 4*a*c;
    if(D < 0) return vector<double>();
    if(D == 0) return vector<double>(1, -b/(2.0 * a));

    // |b| >> |ac|の時の桁落ちを避けるために
    // x_1 = (-b-sign(b)*sqrt(D))/(2*a), x_2 = c / (a*x_1)を利用する
    vector<double> res;
    int sign = (b >= 0) ? 1 : -1;
    double x1 = (-b - sign * sqrt(D))/(2.0 * a);
    double x2 = c / (a * x1);
    res.push_back(x1);
    res.push_back(x2);
    return res;
}

int main(){
    int n;
    double p[222][3];
    double v[222][3];
    double r[222];
    double vr[222];
    while(cin >> n) {
        REP(i, n) {
            REP(j, 3) cin >> p[i][j];
            REP(j, 3) cin >> v[i][j];
            cin >> r[i] >> vr[i];
        }

        vector<T> events;
        REP(i, n) {
            double t = r[i] / vr[i];
            events.push_back(T(t, i, i));
        }
        REP(i, n) REP(j, n) if(i < j) {
            double p1[3];
            REP(k, 3) p1[k] = p[i][k];
            double p2[3];
            REP(k, 3) p2[k] = p[j][k];
            double v1[3];
            REP(k, 3) v1[k] = v[i][k];
            double v2[3];
            REP(k, 3) v2[k] = v[j][k];
            double r1 = r[i];
            double r2 = r[j];
            double vr1 = vr[i];
            double vr2 = vr[j];


            double A = sq(vr1 + vr2);
            double B = -2.0 * (vr1 + vr2) * (r1 + r2);
            double C = sq(r1 + r2);

            REP(k, 3) A -= sq(v2[k] - v1[k]);
            REP(k, 3) B -= 2.0 * (v2[k] - v1[k]) * (p2[k] - p1[k]);
            REP(k, 3) C -= sq(p2[k] - p1[k]);

            vector<double> res = quadratic(A, B, C);
            /*
            cout << i << " " << j << " : ";
            for(double t : res) cout << t << " "; cout << endl;
            */
            for(double t : res) if(t > EPS) events.emplace_back(t, i, j);
        }

        sort(events.begin(), events.end());
        vector<double> ans(n, -1);
        for(T ev : events) {
            double t;
            int a, b;
            tie(t, a, b) = ev;
            if(ans[a] != -1) continue;
            if(ans[b] != -1) continue;
            ans[a] = ans[b] = t;
        }
        REP(i, n) {
            printf("%.12f\n", ans[i]);
        }
    }
    return 0;
}