#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define pb push_back
using namespace std;

const double eps=1.0e-9;

vector<double> solve(double a,double b,double c){
	double d=b*b-4.0*a*c;
	vector<double> result;
	if(d>eps){
		double dd=sqrt(d);
		double ans1=(-b+dd)/(2.0*a);
		if(ans1>eps) result.pb(ans1);
		double ans2=(-b-dd)/(2.0*a);
		if(ans2>eps) result.pb(ans2);
	}else if(abs(d)<eps){
		double ans=-b/(2.0*a);
		if(ans>eps) result.pb(ans);
	}
	return result;
}

double x[210],y[210],z[210],r[210];
double vx[210],vy[210],vz[210],vr[210];


typedef tuple<double,int,int> state;

int main(void){
	int n;
	while(cin >>n,n){
		vector<state> del;
		rep(i,n){
			cin >> x[i] >> y[i] >> z[i];
			cin >> vx[i] >> vy[i] >> vz[i];
			cin >> r[i] >> vr[i];
		}
		rep(i,n){
			double t=1.0*r[i]/vr[i];
			del.pb(state(t,i,i));
		}
		rep(i,n)rep(j,n){
			if(i>=j) continue;
			double a=0.0,b=0.0,c=0.0;

			// x
			c+=(x[i]-x[j])*(x[i]-x[j]);
			b+=2.0*(x[i]-x[j])*(vx[i]-vx[j]);
			a+=(vx[i]-vx[j])*(vx[i]-vx[j]);

			// y
			c+=(y[i]-y[j])*(y[i]-y[j]);
			b+=2.0*(y[i]-y[j])*(vy[i]-vy[j]);
			a+=(vy[i]-vy[j])*(vy[i]-vy[j]);

			// z
			c+=(z[i]-z[j])*(z[i]-z[j]);
			b+=2.0*(z[i]-z[j])*(vz[i]-vz[j]);
			a+=(vz[i]-vz[j])*(vz[i]-vz[j]);

			// r
			c-=(r[i]+r[j])*(r[i]+r[j]);
			b-=-2.0*(r[i]+r[j])*(vr[i]+vr[j]);
			a-=(vr[i]+vr[j])*(vr[i]+vr[j]);
			vector<double> res=solve(a,b,c);
			rep(k,res.size()){
				del.push_back(state(res[k],i,j));
				del.push_back(state(res[k],i,j));
			}
		}
		sort(del.begin(),del.end());
		double ans[210];
		rep(i,210) ans[i]=-1.0;
		for(auto &record:del){
			double t;int i,j;
			tie(t,i,j)=record;
			if(t<0.0) continue;
			if(ans[i]==-1.0&&ans[j]==-1.0) ans[i]=t,ans[j]=t;
		}
		cout.precision(10);
		rep(i,n) cout << fixed << ans[i] << endl;
	}
	return 0;
}