#include<iostream>
#include<complex>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define pb         push_back
#define mp         make_pair
#define fir first
#define sec second

typedef complex<double> P;
typedef vector<P>       gon;
typedef pair<P,P>       Line;

const double eps = 1e-10;
#define EQ(a,b)   (fabs((a)-(b))<eps)

double cross(P a,P b){return ( a.real()*b.imag() - a.imag()*b.real());}

bool isp(P a,P b,P c){return abs(a-c)+abs(b-c) < abs(a-b) + eps;}

bool is_intersected_ll(P a1,P a2,P b1,P b2){return !EQ( cross(a1-a2,b1-b2),0.0);}

P intersection_ll(P a1,P a2,P b1,P b2){
  P a= a2-a1,b=b2-b1;
  return a1+ a*cross(b,b1-a1)/cross(b,a);
}

double distance_l_p(P a,P b,P c){
  return abs( cross(b-a,c-a))/abs(b-a);
}

double bisec(Line &a,P tmp,double rin){
  double l=0,r=10000;
  rep(i,100){
    double mid=(l+r)/2.;
    P now=a.fir+tmp*mid;
    if( fabs(distance_l_p(a.fir,a.sec,now)-rin)<eps)return mid;
    if (distance_l_p(a.fir,a.sec,now) < rin)l=mid+eps;
    else if (distance_l_p(a.fir,a.sec,now)>rin)r=mid-eps;
  }
  return l;
}

P getcand(Line & a,Line & b,double r){
  P ta=(a.sec-a.fir),tb=(b.sec-b.fir);
  ta/=abs(ta);tb/=abs(tb);
  a.sec=a.fir+ta;
  b.sec=b.fir+tb;
  P tmp=((a.sec-a.fir)+(b.sec-b.fir))/2.;
  double theta=arg(tmp);
  //  r=abs(r/sin(theta));

  tmp/=abs(tmp);
  r=bisec(a,tmp,r);

  tmp=tmp/abs(tmp)*r;
  return a.fir+tmp;
}

bool check(Line a,Line b,vector<Line> &in,
	   vector<double> &t,double r,double w,double h){
  if (abs(a.sec-b.sec)<eps)return false;
  if (abs(a.fir-a.sec)<eps||abs(b.fir-b.sec)<eps)return false;
  if (cross(a.sec-a.fir,b.sec-b.fir) < eps)swap(a,b); 
  P cand=getcand(a,b,r);

  //  cout<< distance_l_p(a.fir,a.sec,cand)<<" " << r <<endl;

  if (!(-eps < cand.real()-r && cand.real()+r < w+eps &&
	-eps < cand.imag()-r && cand.imag()+r < h+eps))return false;
  rep(i,in.size()){
    if (distance_l_p(in[i].fir,in[i].sec,cand) < t[i]+r){
      return false;
    }
  }
  return true;
}

bool solve(vector<Line> &a,vector<Line> &b,vector<double>&t,double r,double w,double h){
  rep(i,a.size()){
    REP(j,i+1,a.size()){
      if (is_intersected_ll(a[i].fir,a[i].sec,a[j].fir,a[j].sec)){
	P tmp=intersection_ll(a[i].fir,a[i].sec,a[j].fir,a[j].sec);
	if (isnan(tmp.real()))continue;
	if (check(mp(tmp,a[i].fir),mp(tmp,a[j].fir),b,t,r,w,h)||
	    check(mp(tmp,a[i].fir),mp(tmp,a[j].sec),b,t,r,w,h)||
	    check(mp(tmp,a[i].sec),mp(tmp,a[j].fir),b,t,r,w,h)||
	    check(mp(tmp,a[i].sec),mp(tmp,a[j].sec),b,t,r,w,h)
	    )return true;
      }
    }
  }
  return false;
}

P getnorm(P b,double t){
  P ret=P(-b.imag(),b.real());
  ret=ret/abs(ret)*t;
  return ret;
}

P makeline(P a,P b,double r){
  P tmp=a-b;
  tmp/=abs(tmp);
  return b+tmp*r;
}

main(){
  int w,h,n;
  double r;
  while(cin>>w>>h>>n>>r && w){
    if (n==0){
      cout << "Yes"<<endl;
      continue;
    }
    vector<Line> in;
    vector<Line> in2(n);
    vector<double>tt(n);

    rep(i,n){
      gon tmp;
      P a[2];
      rep(j,2){
	double x,y;cin>>x>>y;a[j]=P(x,y);
      }
      double t;
      cin>>t;
      in2[i]=mp(a[0],a[1]);
      tt[i]=t;

      P norm=getnorm(a[1]-a[0],t);
      rep(j,2){
	tmp.pb(a[j]+norm);
	tmp.pb(a[j]-norm);
      }
      
      
      //      in.pb(mp(tmp[0],tmp[2]));
      //      in.pb(mp(tmp[1],tmp[3]));

      in.pb(mp(makeline(tmp[0],tmp[2],1000),
	       makeline(tmp[2],tmp[0],1000)
	       ));
      in.pb(mp(makeline(tmp[1],tmp[3],1000),
	       makeline(tmp[3],tmp[1],1000)
	       ));
    }
    in.pb(mp(P(0,0),P(w,0)));
    in.pb(mp(P(w,0),P(w,h)));
    in.pb(mp(P(w,h),P(0,h)));
    in.pb(mp(P(0,h),P(0,0)));

//     rep(i,in.size()){
//       cout << "[";
//       cout << in[i].first<<","<<in[i].second;
//       cout << "]";
//     }
//     cout << endl;

    if (solve(in,in2,tt,r,w,h))cout <<"Yes"<<endl;
    else cout << "No"<<endl;

  }
}

Measured memory_bytes: 992