#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
typedef long double D;
typedef pair<int,int> P;
typedef pair<D,P> E;
int N;
D a[200],b[200],c[200],d[200],e[200],f[200],g[200],h[200],en[200],eps=1e-7,ans[200];
bool is[200];
vector<E> es;
D s(D x){return x*x;}
void renew(int i,int j,D x){
	if(0<x&&x<en[i]&&x<en[j]){
		es.pb(E(x,P(i,j)));
	}
}
void fix(D &x){
	if(abs(x)<eps) x=0;
}
int main(){
	while(true){
		cin>>N;
		if(N==0) break;
		es.clear();
		rep(i,N) is[i]=1;
		rep(i,N) cin>>a[i]>>b[i]>>c[i]>>d[i]>>e[i]>>f[i]>>g[i]>>h[i];
		rep(i,N) en[i]=g[i]/h[i];
		rep(i,N) es.pb(E(en[i],P(i,i)));
		rep(i,N) rep(j,i){
			D A=s(d[i]-d[j])+s(e[i]-e[j])+s(f[i]-f[j]);
			D B=2*((d[i]-d[j])*(a[i]-a[j])+(e[i]-e[j])*(b[i]-b[j])+(f[i]-f[j])*(c[i]-c[j]));
			D C=s(a[i]-a[j])+s(b[i]-b[j])+s(c[i]-c[j]);
			A-=s(h[i]+h[j]);
			B+=2*(h[i]+h[j])*(g[i]+g[j]);
			C-=s(g[i]+g[j]);
			fix(A);
			fix(B);
			fix(C);
			if(A==0){
				if(B==0) continue;
				renew(i,j,-C/B);
			}else{
				D D=B*B-4*A*C;
				fix(D);
				if(D<0) continue;
				renew(i,j,(-B+sqrt(D))/(2*A));
				renew(i,j,(-B-sqrt(D))/(2*A));
			}
		}
		sort(all(es));
		rep(i,es.size()){
			if(!is[es[i].sc.fs]||!is[es[i].sc.sc]) continue;
			ans[es[i].sc.fs]=ans[es[i].sc.sc]=es[i].fs;
			is[es[i].sc.fs]=is[es[i].sc.sc]=0;
		}
		rep(i,N) printf("%.12f\n",(double)ans[i]);
	}
}