#include<bits/stdc++.h>
using namespace std;
typedef array<double, 3> P;
typedef double D;
const double EPS = 1e-8;


P tasu(P a, P b) {
	P c;
	for (int i = 0; i < 3; i++) c[i] = a[i] + b[i];
	return c;
}
P kake(D a, P b) {
	P c;
	for (int i = 0; i < 3; i++) c[i] = a * b[i];
	return c;
}

double dist(P a, P b) {
	double x = a[0] - b[0];
	double y = a[1] - b[1];
	double z = a[2] - b[2];
	return sqrt(x * x + y * y + z * z);
}

double mint(P a0, P b0, P da, P db, double ar0, double br0, double dar, double dbr) {
	double m = 0;
	double M = 1e6;
	while (m + EPS * 3 < M) {
		double t = m;
		double A[2] = {};
		double dm = (M - m) /  3;
		for (int i = 0; i < 2; i++) {
			t += dm;
			P a = tasu(a0 , kake(t, da));
			P b = tasu(b0 , kake(t, db));
			double d = dist(a, b);
			double r1 = ar0 - t * dar;
			double r2 = br0 - t * dbr;
			A[i] = d - r1 - r2;
		}
		if (A[0] < A[1]) M = t;
		else m = t - dm;
	}
	return (m + M) / 2;
}

double hantei(P a0, P b0, P da, P db, double ar0, double br0, double dar, double dbr) {
	double m = mint(a0, b0, da,  db, ar0,  br0, dar, dbr);
	m = min(m, ar0 / dar);
	m = min(m, br0 / dbr);
	if (dist(tasu(a0 , kake(m , da)), tasu(b0 , kake(m , db)))  + EPS > br0 - dbr * m + ar0 - dar * m ) return 0;
	double M = m;
	m = 0;
	while (m + EPS / 10 < M) {
		double t = (M + m) / 2;
		P a = tasu(a0 , kake(t , da));
		P b = tasu(b0 , kake(t , db));
		double d = dist(a, b);
		double r1 = ar0 - t * dar;
		double r2 = br0 - t * dbr;
		double A = d - r1 - r2;
		if (A < 0) M = t;
		else m = t;
	}
	return m;
}

double hyou[201][201];
double points[201][8];
int main() {
	cout << setprecision(20) << fixed;
	int N;
	while(cin >> N, N) {
		for(int n = 0; n < N; n++) {
			
			P a;
			double x, y, z, dx, dy, dz, r0, dr;
			cin >> x >> y >> z >> dx >> dy >> dz >> r0 >> dr;
			double A[8] = {x , y , z , dx , dy , dz , r0 , dr};
			for(int i = 0; i < 8; i++) points[n][i] = A[i];
		}
		double star[205] = {};

		for(int i = 0; i < 203; i++) star[i] = 0;
	vector<tuple<double , int, int>> vt;
	for (int i = 0; i < N; i++) {
		double ar0, br0, dar, dbr;
		ar0 = points[i][6];
		dar = points[i][7];
		for (int j = 0; j < i; j++) {
			P a0,b0,db,da;
			br0 = points[j][6];
			dbr = points[j][7];
			for(int k = 0; k < 3; k++) {
				a0[k] = points[i][k];
				b0[k] = points[j][k];
				da[k] = points[i][k + 3];
				db[k] = points[j][k + 3];
			}
			double T = hantei(a0, b0, da,  db, ar0,  br0, dar, dbr);
			
			if (T > 0.0) {
				vt.push_back(make_tuple(T, i, j));
			}
		}
		vt.push_back(make_tuple(ar0 / dar, i, 201));
		
	}
	sort(vt.begin(), vt.end());
	for(auto e : vt) {
		D d = get<0>(e);
		int a = get<1>(e);
		int b = get<2>(e);
		//cout << "(" <<d << ","<< a << "," << b << ")" <<endl;
		if (star[a] == 0.0 and star[b] == 0.0) {
			star[a] = d;
			star[b] = d;
		}
		star[201] = 0;
	}
	for (int i = 0; i < N; i++) {
		cout << star[i] << endl;
	}
	}
}

