#include <iostream>
#include <fstream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

#define EPS 1e-9
#define INF MOD
#define MOD 1000000007LL
#define fir first
#define iss istringstream
#define sst stringstream
#define ite iterator
#define ll long long
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define pi pair<int,int>
#define pb push_back
#define sec second
#define sh(i) (1LL<<i)
#define sz size()
#define vi vector<int>
#define vc vector
#define vl vector<ll>
#define vs vector<string>

#define PI (atan(1.)*4)

int W,H,N,R;

typedef complex<double> P;

struct L : public vector<P> {
  L(){}
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

struct B{L l[2];double t;} b[110];

P e(double t){return P(cos(t),sin(t));}

double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}

double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

P projection(const L &l, const P &p) {
  double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
  return l[0] + t*(l[0]-l[1]);
}

P reflection(const L &l, const P &p) {
  return p + 2.0 * (projection(l, p) - p);
}

bool intersectLL(const L &l, const L &m) {
  return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS || // non-parallel
         abs(cross(l[1]-l[0], m[0]-l[0])) < EPS;   // same line
}

bool nonparallelLL(const L &l, const L &m) {
  return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS;
}

double distanceLP(const L &l, const P &p) {
  return abs(p - projection(l, p));
}

P crosspoint(const L &l, const L &m) {
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
  if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0] + B / A * (m[1] - m[0]);
}

vc<P> twoLC(L l,L m,double r){
	assert(nonparallelLL(l,m));
	P v=l[1]-l[0],w=m[1]-m[0];
	P mid=v/abs(v)+w/abs(w);
	double t=dot(v,w)/abs(v)/abs(w);
	if(fabs(t-1)<EPS)t=0;
	else if(fabs(t+1)<EPS)t=PI;
	else t=acos(t);
	vc<P> res;
	P c=crosspoint(l,m);
	res.pb(c+mid/abs(mid)*r/sin(t/2));
	res.pb(c-mid/abs(mid)*r/sin(t/2));
	mid=v/abs(v)-w/abs(w);
	t=PI-t;
	res.pb(c+mid/abs(mid)*r/sin(t/2));
	res.pb(c-mid/abs(mid)*r/sin(t/2));
	return res;
}
int bug=0;
int main(){
	while(cin>>W>>H>>N>>R,W){
		int OK=0;
		rep(i,N){
			double x,y,xx,yy,t;
			cin>>x>>y>>xx>>yy>>b[i].t;
			P p1(x,y),p2(xx,yy);
			P v=(p2-p1)/abs(p2-p1)*b[i].t*e(PI/2);
			b[i].l[0]=L(p1+v,p2+v),b[i].l[1]=L(p1-v,p2-v);
		}
		rep(i,N)rep2(j,i+1,N)rep(ii,2)rep(jj,2)if(nonparallelLL(b[i].l[ii],b[j].l[jj])){
			vc<P> c=twoLC(b[i].l[ii],b[j].l[jj],R);
			rep(k,4)if(-EPS<real(c[k])-R&&real(c[k])+R<W+EPS&&-EPS<imag(c[k])-R&&imag(c[k])+R<H+EPS){
				int ok=1;
				rep(p,N){
					double v0=max(0.,distanceLP(b[p].l[0],c[k])-R);
					double v1=max(0.,distanceLP(b[p].l[1],c[k])-R);
					if(fabs(v0-v1)+EPS<b[p].t*2)ok=0;
				}
				if(ok){cout<<"Yes"<<endl;if(bug)cout<<i<<" "<<j<<" "<<ii<<" "<<jj<<" "<<c[k]<<endl;OK=1;goto found;}
			}
		}
		found:;
		vc<L> v;
		if(OK)goto found2;
		v.pb(L(P(0,0),P(W,0)));
		v.pb(L(P(0,H),P(W,H)));
		v.pb(L(P(0,0),P(0,H)));
		v.pb(L(P(W,0),P(W,H)));
		rep(i,4)rep(j,N)rep(jj,2)if(nonparallelLL(v[i],b[j].l[jj])){
			vc<P> c=twoLC(v[i],b[j].l[jj],R);
			rep(k,4)if(-EPS<real(c[k])-R&&real(c[k])+R<W+EPS&&-EPS<imag(c[k])-R&&imag(c[k])+R<H+EPS){
				int ok=1;if(bug)cout<<i<<" "<<v[i][0]<<" "<<v[i][1]<<" "<<b[j].l[jj][0]<<" "<<b[j].l[jj][1]<<endl;
				rep(p,N){
					double v0=max(0.,distanceLP(b[p].l[0],c[k])-R);
					double v1=max(0.,distanceLP(b[p].l[1],c[k])-R);
					if(fabs(v0-v1)+EPS<b[p].t*2)ok=0;if(bug)cout<<v0<<" "<<v1<<" "<<fabs(v0-v1)<<" "<<b[p].t<<endl;
				}
				if(ok){cout<<"Yes"<<endl;if(bug)cout<<i<<" "<<j<<" "<<jj<<" "<<k<<" "<<c[k]<<endl;OK=1;goto found2;}
			}
		}
		found2:;
		if(!OK)cout<<"No"<<endl;
	}
}

Measured memory_bytes: 996