//150
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cassert>
#include<sstream>
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<cstring>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef pair<double,double> pt;

int INF=1001001001;

double dis(pt p1,pt p2){
	return (p1.first-p2.first)*(p1.first-p2.first)+(p1.second-p2.second)*(p1.second-p2.second);
}
pt linedist00(double x,double y,double vx,double vy){
	double l=(x*vy-y*vx)/(vx*vx+vy*vy);
	return pt(l*vy,-l*vx);
}
pair<double,pair<double,double> > culc(double r,double x,double y,double vx,double vy){
	pt p2=linedist00(x,y,vx,vy);
	double vv=dis(pt(0,0),pt(vx,vy));
	double d2=dis(pt(0,0),p2);
	if(d2 <= r*r){
		double l=r*r-d2;
		double t;
		if(vx==0 && vy==0) return pair<double,pair<double,double> >(INF,pair<double,double>(INF,INF));
		else if(vx==0) t= (p2.second-y)/vy;
		else t= (p2.first-x)/vx;
		double dt=sqrt(l/vv);
		return pair<double,pair<double,double> >(t-dt,pair<double,double>(t,t+dt));
	}else{
		return pair<double,pair<double,double> >(INF,pair<double,double>(INF,INF));
	}
}
struct str{
	double t;
	pint p;
	int f;
	str(double t0,pint p0,int f0){
		t=t0; p=p0; f=f0;
	}
};
void prints(str a){
	printf("t=%f  %d---%d  %d\n",a.t,a.p.first,a.p.second,a.f);
}
bool operator<(str a,str b){
	return a.t>b.t;
}

int main(){
	int i,j,k;
	int n,t,r;
	pt xy[100];
	pair<int,int> v[100][1000];
	int p[100];
	string name[1000];
	int chk[100];
	while(1){
		cin >> n >> t >> r;
		if(n==0) break;
		for(i=0;i<100;i++){
			chk[i]=0;
			for(j=0;j<1000;j++){
				v[i][j]=pint(INF,INF);
			}
		}
		for(i=0;i<n;i++){
			cin >> name[i];
			cin >> k >> xy[i].first >> xy[i].second;
			while(1){
				int tk,vx,vy;
				scanf("%d %d %d",&tk,&vx,&vy);
				v[i][tk-1].first=vx;
				v[i][tk-1].second=vy;
				if(tk==t) break;
			}
		}
		for(k=0;k<n;k++){
			pint tmp=v[k][t-1];
			for(i=t-2;i>=0;i--){
				if(v[k][i].first==INF) v[k][i]=tmp;
				else tmp=v[k][i];
			}
		}
		int a[100][100];
		for(j=0;j<n;j++){
			for(k=0;k<n;k++){
				if(dis(xy[j],xy[k]) <= r*r) a[j][k]=1;
				else a[j][k]=0;
			}
		}
		queue<int> q;
		q.push(0);
		while(!q.empty()){
			int f=q.front(); q.pop();
			if(chk[f]==1) continue;
			else{
				chk[f]=1;
				for(i=0;i<n;i++){
					if(a[f][i]==1) q.push(i);
				}
			}
		}
		for(i=0;i<t;i++){
			priority_queue<str> pq;
			for(j=0;j<n;j++){
				for(k=j+1;k<n;k++){
					int x1=xy[k].first-xy[j].first,y1=xy[k].second-xy[j].second;
					int vx=v[k][i].first-v[j][i].first,vy=v[k][i].second-v[j][i].second;
					
					pair<double,pair<double,double> > time=culc(r,x1,y1,vx,vy);
					if(time.first==INF) continue;
					double t1=INF,t2=INF;
					if(time.first >= 0.0){
						if(time.second.second <= 1.0){
							t1=time.first;
							t2=time.second.second;
						}else if(time.first <= 1.0){
							t1=time.first;
						}
					}else{
						if(time.second.second>=0 && time.second.second<=1.0){
							t2=time.second.second;
						}
					}
					if(t1!=INF) pq.push(str(t1,pint(j,k),1));
					if(t2!=INF) pq.push(str(t2,pint(j,k),0));
				}
			}
			while(!pq.empty()){
				str tmp=pq.top(); pq.pop();
//				prints(tmp);
				a[tmp.p.first][tmp.p.second]=tmp.f;
				a[tmp.p.second][tmp.p.first]=tmp.f;
				if(tmp.f==1){
					if(chk[tmp.p.first]==0 && chk[tmp.p.second]==1) swap(tmp.p.first,tmp.p.second);
					if(chk[tmp.p.first]==1 && chk[tmp.p.second]==0){
						queue<int> q2;
						q2.push(tmp.p.second);
						chk[tmp.p.second]=1;
						while(!q2.empty()){
							k=q2.front();
							q2.pop();
							for(j=0;j<n;j++){
								if(a[j][k]==1 && chk[j]==0){
									chk[j]=1;
									q2.push(j);
								}
							}
						}
					}
				}
			}
			for(j=0;j<n;j++){
				xy[j].first+=v[j][i].first;
				xy[j].second+=v[j][i].second;
			}
		}
		
		vector<string> ans;
		int cnt=0;
		for(i=0;i<n;i++){
			if(chk[i]==1){
				ans.push_back(name[i]);
				cnt++;
			}
		}
		sort(ans.begin(),ans.end());
		for(i=0;i<cnt;i++){
			cout << ans[i] << endl;
		}
					
					
		
		
	}	
	return 0;
}
	

Measured memory_bytes: 1844