#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include<fstream>
#include<iomanip>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);

struct Star 
{
	double px, py, pz, vx, vy, vz, r, vr;

	double posx(double t) const { return px + vx * t; }
	double posy(double t) const { return py + vy * t; }
	double posz(double t) const { return pz + vz * t; }
	double nowr(double t) const { return r - vr * t; }

	double limit() const { return r / vr; }
};

struct Extinct 
{
	double time; //消滅時間
	pair<int, int> obj;//消滅対象

	bool operator < (const Extinct r)const 
	{
		return time < r.time;
	}
};

struct Stage 
{
	const double esp = 1e-9;
	int n;

	Stage() 
	{
		cin >> n;
		if (!n)return;
		REP(i, n) 
		{
			Star s;
			cin >> s.px >> s.py >> s.pz >> 
				s.vx >> s.vy >> s.vz >> s.r >> s.vr;
			stars.push_back(s);
		}
	}

	void action()
	{
		vector<bool> exist(n, true);
		vector<double> time(n);
		vector<Extinct> extincts;

		REP(i, n) {
			Extinct extinct;
			extinct.obj = { i,i };
			extinct.time = stars[i].limit();
			extincts.push_back(extinct);
		}

		REP(l, n) {
			FOR(r, l + 1, n)
			{
				Extinct data;
				if (collision(l, r, data))
				{
					extincts.push_back(data);
				}
			}
		}
		sort(extincts.begin(), extincts.end());

		for (auto data : extincts)
		{
			auto obj = data.obj;
			if (!exist[obj.first] || !exist[obj.second])continue;

			time[obj.first] = time[obj.second] = data.time;
			exist[obj.first] = exist[obj.second] = false;
		}

		cout << fixed;
		REP(i, n)
		{
			cout << setprecision(10) << time[i] << endl;
			/*
			cerr << "============" << endl;
			cerr << i << ":  ";
			cout << time[i] << endl;
			cerr << "============" << endl;
			*/
		}
	}

private:
	vector<Star> stars;
	
	bool collision(const int l, const int r, Extinct& extinct) const
	{
		const Star& a = stars[l];
		const Star& b = stars[r];
		double mint = three_search(a, b);
		if (calc_dist(a, b, mint) > 0)return false;

		double res = binary_search(a, b, mint);
		extinct.obj = { l,r };
		extinct.time = res;
		return true;
	}

	double three_search(const Star& a, const Star& b) const
	{
		double l = 0;
		double r = min(a.limit(), b.limit());
		while (r - l > esp)
		{
			double midl = (l * 2 + r) / 3;
			double midr = (l + r * 2) / 3;
			double distl = calc_dist(a, b, midl);
			double distr = calc_dist(a, b, midr);

			if (distl < distr) {
				r = midr;
			}
			else {
				l = midl;
			}
		}
		return l;
	}

	double binary_search(const Star& a, const Star& b, double mint)const
	{
		double l = 0;
		double r = mint;
		while (r - l > esp) {
			double mid = (l + r) / 2;
			if (calc_dist(a, b, mid)>0) {
				l = mid;
			}
			else {
				r = mid;
			}
		}
		return l;
	}

	double calc_dist(const Star& a, const Star& b, const double t) const 
	{
		double dx = a.posx(t) - b.posx(t);
		double dy = a.posy(t) - b.posy(t);
		double dz = a.posz(t) - b.posz(t);
		double dr = sqrt(dx*dx + dy * dy + dz * dz);
		double dist = a.nowr(t) + b.nowr(t);

		return dr - dist;
	}

};


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	while (true)
	{
		Stage stage;
		if (!stage.n)break;
		stage.action();
	}
	debug();
	
	return 0;
}



Measured memory_bytes: 3268