#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int n, T, r;
string name[100];
vi t[100], vx[100], vy[100], x[100], y[100];
bool e[100][100], data[100][100];

inline double d2(ll x, ll y){
	return x * x + y * y;
}
inline vector<double> crosspoint(ll x, ll y, ll vx, ll vy){
	ll a = vx * vx + vy * vy;
	ll b = x * vx + y * vy;
	ll c = x * x + y * y - r * r;
	vector<double> res;
	
	if(a == 0){
		if(b == 0) return res;
		assert(0);
	}
	double D = b * b - a * c;
	if(D < -EPS) return res;
	D = max(0.0, D);
	
	res.pb((-b - sqrt(D)) / a);
	res.pb((-b + sqrt(D)) / a);
	
	rep(i, 2){
		double tx = x + vx * res[i], ty = y + vy * res[i];
		assert(abs(hypot(tx, ty) - r) < EPS);
	}
	
	return res;
}

int main(){
	while(cin >> n >> T >> r, n){
		memset(e, 0, sizeof(e));
		memset(data, 0, sizeof(data));
		
		rep(i, n){
			t[i].clear(); vx[i].clear(); vy[i].clear();
			x[i].clear(); y[i].clear();
			
			int a, b, c;
			cin >> name[i] >> a >> b >> c;
			t[i].pb(a); x[i].pb(b);  y[i].pb(c);
			
			while(cin >> a >> b >> c){
				t[i].pb(a); vx[i].pb(b); vy[i].pb(c);
				int dt = a - t[i][t[i].size() - 2];
				x[i].pb(x[i].back() + dt * vx[i].back());
				y[i].pb(y[i].back() + dt * vy[i].back());
				if(a == T) break;
			}
		}
		vector<pair<double, int> > event;
		
		rep(i, n) rep(j, i){
			if(d2(x[i][0] - x[j][0], y[i][0] - y[j][0]) <= r * r) e[i][j] = e[j][i] = 1;
			
			rep(k, vx[i].size()) rep(l, vx[j].size()){
				if(t[i][k] > t[j][l + 1] || t[j][l] > t[i][k + 1]) continue;
				
				int dt = t[j][l] - t[i][k];
				int dvx = vx[i][k] - vx[j][l], dvy = vy[i][k] - vy[j][l];
				int dx = x[i][k] + vx[i][k] * dt - x[j][l], dy = y[i][k] + vy[i][k] * dt - y[j][l];
				
				vector<double> ts = crosspoint(dx, dy, dvx, dvy);
				
				rep(h, ts.size()){
					double tt = ts[h] + t[j][l];
					if(max(t[i][k], t[j][l]) <= tt && tt <= min(t[i][k + 1], t[j][l + 1])){
						int tmp = i * n + j + 1;
						event.pb(mp(tt, h == 0 ? tmp : -tmp));
					}
				}
			}
		}
		sort(all(event));
		
		rep(i, n) rep(j, n) data[i][j] = i == j || e[i][j];
		rep(k, n) rep(i, n) rep(j, n) data[i][j] |= data[i][k] && data[k][j];
		
		each(it, event){
			int a = (abs(it->second) - 1) / n, b = (abs(it->second) - 1) % n;
			if(it->second > 0){
				e[a][b] = e[b][a] = 1;
				bool g[100][100];
				rep(i, n) rep(j, n) g[i][j] = e[i][j] || i == j;
				rep(k, n) rep(i, n) rep(j, n) g[i][j] |= g[i][k] && g[k][j];
				
				rep(i, n) rep(j, n) if(g[i][j]) rep(k, n) data[i][k] = data[j][k] = data[i][k] || data[j][k];
			}
			else{
				e[a][b] = e[b][a] = 0;
			}
		}
		vector<string> ans;
		rep(i, n) if(data[i][0]) ans.pb(name[i]);
		sort(all(ans));
		rep(i, ans.size()) cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1452