#include <iostream>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <climits>
#include <numeric>
#include <queue>
#include <cmath>
#include <iomanip>
#include <array>
#include <string>
#include <stack>
#include <cassert>
#include <memory>
#include <random>
#include <fstream>
constexpr double EPS = 1e-10;
inline bool is_zero(const double& that) {
	return std::abs(that) < EPS;
}
struct Polynomial {
	virtual std::vector<double> root() const = 0;
	virtual double operator[](const double x) const = 0;
};
class Constant : public Polynomial {
	double constant;
public:
	Constant(const double c) : constant{ c } {};
	std::vector<double> root() const override {
		return {};
	}
	double operator[](const double x) const override {
		return constant;
	}
};
class Linear : public Polynomial {
	double constant;
public:
	Linear(const double _c1, const double _c) :constant{ _c / _c1 } {};
	virtual std::vector<double> root() const override
	{
		return {-constant};
	}

	virtual double operator[](const double x) const override
	{
		return x + constant;
	}

};
class Quadratic : public Polynomial {
	double c1, constant;
public:	
	Quadratic(const double _c2, const double _c1, const double _c) : c1{ _c1 / _c2 }, constant{ _c / _c2 }{};
	virtual std::vector<double> root() const override
	{
		const auto d = -(c1 * c1 / 4) + constant;
		if (d > 0) return {};
		if (is_zero(d)) return { -c1 / 2 };
		const auto r = std::sqrt(-d);
		return { -c1 / 2 - r, -c1 / 2 + r };
	}
	virtual double operator[](const double x) const override
	{
		return x * x + c1 * x + constant;
	}
};
std::unique_ptr<Polynomial> make_polynomal(const double c2, const double c1, const double c) {
	if (is_zero(c2) && is_zero(c1)) return std::make_unique<Constant>(c);
	if (is_zero(c2)) return std::make_unique<Linear>(c1, c / c1);
	return std::make_unique<Quadratic>(c2, c1, c);
}
struct Position {
	double x, y, z;
};
struct Vector {
	double dx, dy, dz;
};
Vector operator-(const Position& a, const Position& b) {
	return { a.x - b.x, a.y - b.y, a.z - b.z };
}
Vector operator-(const Vector& a, const Vector& b) {
	return { a.dx - b.dx, a.dy - b.dy, a.dz - b.dz };
}
struct ShootingStar {
	Position initial;
	Vector velocity;
	double radius, vr;
	double vanish_time() const {
		return radius / vr;
	}
	double collision_time(const ShootingStar& that) const {
		const auto p = initial - that.initial;
		const auto d = velocity - that.velocity;
		const auto sr = radius + that.radius;
		const auto dr = vr + that.vr;
		const auto c2 = d.dx * d.dx + d.dy * d.dy + d.dz * d.dz - dr * dr;
		const auto c1 = 2 * (p.dx * d.dx + p.dy * d.dy + p.dz * d.dz + sr * dr);
		const auto c = p.dx* p.dx + p.dy * p.dy + p.dz * p.dz - sr * sr;
		const auto poly = make_polynomal(c2, c1, c);
		auto roots = poly->root();
		std::sort(roots.begin(), roots.end());
		const auto pos = std::upper_bound(roots.begin(), roots.end(), 0.0);
		if (pos == roots.end()) return -1;
		else return *pos;
	}
};

int main() {
	std::cin.sync_with_stdio(false);
	std::cin.tie(nullptr);
	while (true) {
		int n; std::cin >> n; if (n == 0) break;
		std::vector<ShootingStar> stars(n);
		for (auto& star : stars) {
			std::cin >> star.initial.x >> star.initial.y >> star.initial.z >> star.velocity.dx >> star.velocity.dy >> star.velocity.dz >> star.radius >> star.vr;
		}
		const auto comparator = [](const std::pair<std::vector<int>, double>& a, const std::pair<std::vector<int>, double>& b) {return a.second > b.second; };
		std::priority_queue<std::pair<std::vector<int>, double>, std::vector<std::pair<std::vector<int>, double>>, decltype(comparator)> queue(comparator);
		for (auto i = 0; i < stars.size(); ++i) {
			queue.emplace(std::vector<int>{ i }, stars[i].vanish_time());
			for (auto j = 0; j < i; ++j) {
				const auto time = stars[i].collision_time(stars[j]);
				if (time < 0) continue;
				queue.emplace(std::vector<int>{i, j}, time);
			}
		}
		std::vector<double> times(n, 0.0);
		while (!queue.empty()) {
			const auto top = queue.top(); queue.pop();
			if (top.first.size() > 1) {
				if (times[top.first[0]] == 0.0 && times[top.first[1]] == 0.0) {
					times[top.first[0]] = times[top.first[1]] = top.second;
				}
			}
			else {
				if (times[top.first[0]] == 0.0) {
					times[top.first[0]] = top.second;
				}
			}
		}
		for (const auto& t : times) {
			std::cout << std::setprecision(10) << std::fixed << t << '\n';
		}
	}
}


Measured memory_bytes: 4616