#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<cmath>
#include<functional>
#include<algorithm>
#include <iomanip>
#define INF (1<<29)
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int n;
double px[200],py[200],pz[200];
double vx[200],vy[200],vz[200];
double r[200],vr[200];


double squ(double x){return x*x;}


struct S{
	double t;
	int a,b;
	S(double t,int a,int b):t(t),a(a),b(b){}
	bool operator<(const S &s)const{return t<s.t;}
};



int main(){
	bool exist[200];


	while(cin>>n&&n){
		rep(i,n){
			cin>>px[i]>>py[i]>>pz[i];
			cin>>vx[i]>>vy[i]>>vz[i];
			cin>>r[i]>>vr[i];
		}
		memset(exist,true,sizeof(exist));
		vector<S> ev;

		rep(i,n){
			ev.push_back(S(r[i]/vr[i],i,-1));
			for(int j=i+1;j<n;j++){
				double a,b,c;
				a=b=c=0;
				a+=squ(vx[i]-vx[j]);
				a+=squ(vy[i]-vy[j]);
				a+=squ(vz[i]-vz[j]);
				a-=squ(vr[i]+vr[j]);

				b+=2*(vx[i]-vx[j])*(px[i]-px[j]);
				b+=2*(vy[i]-vy[j])*(py[i]-py[j]);
				b+=2*(vz[i]-vz[j])*(pz[i]-pz[j]);
				b-=-2*(vr[i]+vr[j])*(r[i]+r[j]);

				c+=squ(px[i]-px[j]);
				c+=squ(py[i]-py[j]);
				c+=squ(pz[i]-pz[j]);
				c-=squ(r[i]+r[j]);

				if(0<=b*b-4*a*c){
					double s=sqrt(b*b-4*a*c);
					double t=(-b-s)/a/2;
					double r=(-b+s)/a/2;
					if(0<t)ev.push_back(S(t,i,j));
					else if(0<r)ev.push_back(S(r,i,j));
				}
			}
		}
		sort(ev.begin(),ev.end());
		double ans[200];
		int cnt=0;
		rep(i,ev.size()){
			if(ev[i].b==-1){
				if(exist[ev[i].a]){
					exist[ev[i].a]=false;
					ans[ev[i].a]=ev[i].t;
					cnt++;
				}
			}else{
				if(exist[ev[i].a]&&exist[ev[i].b]){
					exist[ev[i].a]=exist[ev[i].b]=false;
					ans[ev[i].a]=ans[ev[i].b]=ev[i].t;
					cnt+=2;
				}
			}
			if(cnt==n){
				break;
			}
		}
		rep(i,n){
			printf("%.10f\n",ans[i]);
		}
	}
	return 0;
}