#include <iostream>
#include <cmath>
#include <tuple>
#include <vector>
#include <algorithm>
using namespace std;
typedef tuple<double,double,double> T;

T operator-(const T Ta, const T Tb){
    double Xa,Ya,Za,Xb,Yb,Zb;
    tie(Xa,Ya,Za)=Ta;
    tie(Xb,Yb,Zb)=Tb;
    return T(Xa-Xb,Ya-Yb,Za-Zb);
}

double inner_cross(T Ta, T Tb){
    double Xa,Ya,Za,Xb,Yb,Zb;
    tie(Xa,Ya,Za)=Ta;
    tie(Xb,Yb,Zb)=Tb;
    return Xa*Xb+Ya*Yb+Za*Zb;
}

typedef tuple<T,T,double,double> Star;
typedef tuple<double,int,int> Event;


int main(){
    int N;
    cout<<fixed;
    cout.precision(10); 
    while(cin>>N,N){
        vector<Star> V;
        vector<Event> E;
        vector<double> lifetime(N);
        for(int i=0;i<N;i++){
            double px,py,pz,vx,vy,vz,r,vr;
            cin>>px>>py>>pz>>vx>>vy>>vz>>r>>vr;
            E.emplace_back(r/vr,i,i);
            V.emplace_back(T(px,py,pz),T(vx,vy,vz),r,vr);
        }
        for(int i=0;i<N;i++){
            for(int j=i+1;j<N;j++){
                T Pa,Pb,Va,Vb;
                double ra,rb,vra,vrb;
                tie(Pa,Va,ra,vra)=V[i];
                tie(Pb,Vb,rb,vrb)=V[j];
                double A=inner_cross(Va-Vb,Va-Vb)-pow(vra+vrb,2);
                if(A==0) continue;
                double B=2.0*inner_cross(Pa-Pb,Va-Vb)+2.0*(ra+rb)*(vra+vrb);
                double C=inner_cross(Pa-Pb,Pa-Pb)-pow(ra+rb,2);
                if(B*B-4*A*C<0) continue;
                double t=(-B-sqrt(B*B-4*A*C))/(2*A);
                // cout<<A<<' '<<B<<' '<<C<<' '<<t<<endl;
                if(t<0) continue;
                E.emplace_back(t,i,j);
            }
        }
        sort(E.begin(), E.end());
        bool alive[N];
        fill(alive,alive+N,true);
        for(auto e:E){
            double t;
            int a,b;
            tie(t,a,b)=e;
            if(alive[a]&&alive[b]){
                lifetime[a]=lifetime[b]=t;
                alive[a]=alive[b]=false;
            }
        }
        for(auto l:lifetime){
            cout<<l<<endl;
        }
    }
}