#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <queue>
#include <iostream>
#include <tuple>
#include <vector>
using namespace std;

#define REP(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) REP(i, 0, n)
#define ALL(v) begin(v), end(v)

constexpr double EPS = 1e-8;

struct point {
	double x, y;
	point(double x_, double y_):x(x_), y(y_) {}

	point operator+(const point &p) const {
		return point(x + p.x, y + p.y);
	}

	point operator-(const point &p) const {
		return point(x - p.x, y - p.y);
	}

	point operator*(double d) const {
		return point(x * d, y * d);
	}
};

double norm(const point &p) {
	return p.x * p.x + p.y * p.y;
}

double dot(const point &a, const point &b) {
	return a.x * b.x + a.y * b.y;
}

typedef tuple<double, int, int> event; // time, idx1, idx2
typedef priority_queue<event, vector<event>, greater<event>> event_queue;

// ax^2 + bx + c = 0
vector<double> solve_quadratic_equation(double a, double b, double c) {
	if(abs(a) <= EPS) {
		if(abs(b) <= EPS) return vector<double>();
		return {- c / b};
	}

	const double d = b * b - 4 * a * c;
	if(d < -EPS) return vector<double>();

	return {(-b - sqrt(d)) / (2 * a), (-b + sqrt(d)) / (2 * a)};
}


vector<double> get_times(const point &a, const point &va, const point &b, const point &vb, int r) {
	const point d_p = a - b;
	const point d_v = va - vb;

	double l = norm(d_v);
	double m = 2 * dot(d_p, d_v);
	double n = norm(d_p) - r * r;

	return solve_quadratic_equation(l, m, n);
}

vector<double> calculate(const vector<int> &ta, const vector<point> &va, const vector<int> &tb, const vector<point> &vb, int r) {

	const int n = ta.size();
	const int m = tb.size();

	point a = va[0];
	point b = vb[0];

	vector<double> res;

	if(norm(a - b) <= r * r) res.emplace_back(0);

	int i = 0, j = 0;
	while(true) {
		const int start = max(ta[i], tb[j]);
		const int finish = min(ta[i + 1], tb[j + 1]);

		if(start < finish) {
			const auto times = get_times(a + va[i + 1] * (start - ta[i]), va[i + 1],
										 b + vb[j + 1] * (start - tb[j]), vb[j + 1], r);

			for(const double &t : times) {
				if(EPS <= t && t <= finish - start) res.emplace_back(t + start);
			}
		}

		if(finish == ta[i + 1]) a = a + va[i + 1] * (ta[i + 1] - ta[i]), ++i;
		if(finish == tb[j + 1]) b = b + vb[j + 1] * (tb[j + 1] - tb[j]), ++j;

		if(i == n - 1 || j == m - 1) break;
	}

	return res;
}

void update_know(vector<bool> &know, const vector<vector<bool>> &mat) {
	const int n = know.size();
	queue<int> que;
	rep(i, n) {
		if(know[i]) que.push(i);
	}

	while(!que.empty()) {
		const int v = que.front();
		que.pop();

		rep(i, n) {
			if(mat[v][i] && !know[i]) {
				que.push(i);
				know[i] = true;
			}
		}
	}
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	for(int n, T, r; cin >> n >> T >> r && n;) {
		vector<string> names(n);
		vector<vector<int>> t(n);
		vector<vector<point>> vec(n);

		rep(i, n) {
			cin >> names[i];

			while(true) {
				int time, x, y;
				cin >> time >> x >> y;
				t[i].emplace_back(time);
				vec[i].emplace_back(x, y);
				if(time == T) break;
			}
		}

		event_queue que;
		rep(i, n) {
			rep(j, i) {
				const auto times = calculate(t[i], vec[i], t[j], vec[j], r);
				for(const auto &e : times) {
					que.push(make_tuple(e, j, i));
				}
			}
		}

		vector<vector<bool>> mat(n, vector<bool>(n, false));
		vector<bool> know(n, false);
		know[0] = true;
		while(!que.empty()) {
			const int v = get<1>(que.top());
			const int u = get<2>(que.top());
			que.pop();

			mat[v][u] = mat[u][v] = !mat[v][u];
			if(mat[v][u]) update_know(know, mat);
		}

		vector<string> know_robots;
		rep(i, n) {
			if(know[i]) know_robots.emplace_back(names[i]);
		}

		sort(ALL(know_robots));
		for(const auto &e : know_robots) {
			cout << e << endl;
		}
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1408