#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60 ;
constexpr ll mod=1e9+7 ;

pair<double,double> solve(double x,double y,double z,double tx, double ty, double tz, double r, double tr){
    double a=tx*tx+ty*ty+tz*tz-tr*tr;
    double b=2*(x*tx+y*ty+z*tz+r*tr);
    double c=x*x+y*y+z*z-r*r;
    if(abs(a)<1e-9){
        if(abs(b)<1e-9)return {-1,-1};
        else return {-1,-c/b};
    }
    double d = b*b-4*a*c;
    if(d<0)return {-1,-1};
    if(b>0){
        return {(-b-sqrt(d))/(2*a), (-2*c)/(b+sqrt(d))};
    }
    else {
        return {(-b+sqrt(d))/(2*a), (-2*c)/(b-sqrt(d))};
    }
} 

void solve(int n){
    vector<double> x(n),y(n),z(n),vx(n),vy(n),vz(n),r(n),vr(n);
    rep(i,n)cin>>x[i]>>y[i]>>z[i]>>vx[i]>>vy[i]>>vz[i]>>r[i]>>vr[i];
    vector<pair<double,pair<int,int>>> die;
    rep(i,n){
        die.push_back({r[i]/vr[i],{i,i}});
    }
    rep(i,n)rep(j,i){
        auto res = solve(x[i]-x[j],y[i]-y[j],z[i]-z[j],vx[i]-vx[j],vy[i]-vy[j],vz[i]-vz[j],r[i]+r[j],vr[i]+vr[j]);
        if(res.first>=0){
            die.push_back({res.first,{i,j}});
        }
        if(res.second>=0){
            die.push_back({res.second,{i,j}});
        }
    }
    sort(die.begin(),die.end());
    vector<int> used(n);
    vector<double> ans(n);
    for(auto p:die){
        if(used[p.second.first]||used[p.second.second])continue;
        ans[p.second.first]=p.first;
        ans[p.second.second]=p.first;
        used[p.second.first]=1;
        used[p.second.second]=1;
    }
    rep(i,n)cout<<ans[i]<<endl;
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    int n;
    while(cin>>n,n!=0)solve(n);
    return 0;
}
