#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<double> px(n), py(n), pz(n), vx(n), vy(n), vz(n), r(n), vr(n);
        for(int i=0; i<n; ++i)
            cin >> px[i] >> py[i] >> pz[i] >> vx[i] >> vy[i] >> vz[i] >> r[i] >> vr[i];

        multimap<double, pair<int, int> > mm;
        for(int i=0; i<n; ++i)
            mm.insert(make_pair(r[i] / vr[i], make_pair(i, i)));
        for(int i=0; i<n; ++i){
            for(int j=i+1; j<n; ++j){
                double a = pow(vx[i] - vx[j], 2) +
                           pow(vy[i] - vy[j], 2) +
                           pow(vz[i] - vz[j], 2) -
                           pow(vr[i] + vr[j], 2);
                double b = ((vx[i] - vx[j]) * (px[i] - px[j]) +
                            (vy[i] - vy[j]) * (py[i] - py[j]) +
                            (vz[i] - vz[j]) * (pz[i] - pz[j]) +
                            (vr[i] + vr[j]) * ( r[i] +  r[j])) * 2;
                double c = pow(px[i] - px[j], 2) +
                           pow(py[i] - py[j], 2) +
                           pow(pz[i] - pz[j], 2) -
                           pow( r[i] +  r[j], 2);

                double d = b * b - 4 * a * c;
                if(d < 0)
                    continue;

                double t1 = (- b - sqrt(d)) / (2 * a);
                double t2 = (- b + sqrt(d)) / (2 * a);
                if(t1 > 0)
                    mm.insert(make_pair(t1, make_pair(i, j)));
                if(t2 > 0)
                    mm.insert(make_pair(t2, make_pair(i, j)));
            }
        }

        vector<bool> check(n, false);
        vector<double> ans(n);
        for(const auto& p : mm){
            int i = p.second.first;
            int j = p.second.second;
            if(!check[i] && !check[j]){
                check[i] = check[j] = true;
                ans[i] = ans[j] = p.first;
            }
        }

        for(int i=0; i<n; ++i)
            printf("%.10f\n", ans[i]);
    }
}