#include<bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pi M_PI
#define inf 1<<30
#define eps (1e-10)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;

class Point{
public:
  double x,y;
  Point(double x=0,double y=0):x(x),y(y){}

  Point operator+(Point p){ return Point(x+p.x,y+p.y);}
  Point operator-(Point p){ return Point(x-p.x,y-p.y);}
  Point operator*(double k){ return Point(x*k,y*k);}
  Point operator/(double k){ return Point(x/k,y/k);}
  bool operator<(Point p)const{ return (x!=p.x ? x<p.x : y<p.y);}
  bool operator==(Point p)const{ return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}

  double abs(){ return sqrt(norm());}
  double norm(){ return (x*x+y*y);}
};
typedef Point Vector;
typedef vector<Point> Polygon;

class Segment{
public:
  Point p1,p2;
  Segment(Point p1=Point(),Point p2=Point()):p1(p1),p2(p2){}
};
typedef Segment Line;

class Circle{
public:
  Point c;
  double r;
  Circle(Point c=Point(),double r=0.0):c(c),r(r){}
};

double norm(Vector a){ return (a.x*a.x+a.y*a.y);}
double abs(Vector a){ return sqrt(norm(a));}
double dot(Vector a,Vector b){ return (a.x*b.x+a.y*b.y);}
double cross(Vector a,Vector b){ return (a.x*b.y-a.y*b.x);}

bool isParallel(Vector a,Vector b){
  return equals(cross(a,b),0.0);
}

Point getCrossPointLL(Line a,Line b){
  double A=cross(a.p2-a.p1,b.p2-b.p1);
  double B=cross(a.p2-a.p1,a.p2-b.p1);
  if(abs(A)<eps || abs(B)<eps)return b.p1;
  return b.p1+(b.p2-b.p1)*(B/A);
}

// Vector???90????????¢
Vector rotateVector90(Vector v){
  swap(v.x,v.y);
  v.y*=-1;
  return v;
}

// dis??????Line??????????§????
pair<Line,Line> getParalellLine(Line L,double dis){
  Vector v=L.p2-L.p1;
  v=rotateVector90(v);
  v=(v*dis)/abs(v);
  return mp(Line(L.p1+v,L.p2+v),Line(L.p1-v,L.p2-v));
}

double getDistanceLP(Line l,Point p){
  return abs(cross(l.p2-l.p1,p-l.p1)/abs(l.p2-l.p1));
}

Point rotate(Point base,Point a,double r){
  Point b=a-base;
  a.x=b.x*cos((r/180)*M_PI)-b.y*sin((r/180)*M_PI);
  a.y=b.x*sin((r/180)*M_PI)+b.y*cos((r/180)*M_PI);
  a=a+base;
  return a;
}

int h,w,n;
vector<pair<Line,double> > vl;
vector<pair<Line,Line> > vpl;
vector<Line> vs;

bool in(Circle c){
  double disa=c.c.x-c.r,disb=c.c.x+c.r,disc=c.c.y-c.r,disd=c.c.y+c.r;
  if(disa<-eps || (w-disa)<-eps)return false;
  if(disb<-eps || (w-disb)<-eps)return false;
  if(disc<-eps || (h-disc)<-eps)return false;
  if(disd<-eps || (h-disd)<-eps)return false;
  return true;
}

bool check(Circle c){
  if(!in(c))return false;
  for(int i=0;i<n;i++){
    double dis=getDistanceLP(vl[i].f,c.c);
    if((dis-(c.r+vl[i].s))<-eps)return false;
  }
  return true;
}

bool check(Line L1,Line L2,double R){
  if(isParallel(L1.p1-L1.p2,L2.p1-L2.p2))return false;
  Point origin=getCrossPointLL(L1,L2),temp;
  Point p1=L1.p1,p2=L2.p1;
  Vector v1,v2,v3;
  double s,x;

  if(equals(abs(L1.p1-origin),0.0))p1=L1.p2;
  if(equals(abs(L2.p1-origin),0.0))p2=L2.p2;

  v1=p1-origin,v2=p2-origin;
  s=acos(dot(v1,v2)/(abs(v1)*abs(v2)))/2.0;
  x=(R/sin(s));
  v3=rotate(origin,p1,180-(s*360/(2*pi)))-origin;
  v3=v3*x/abs(v3);
  temp=origin+v3;
  //printf("%.10f %.10f %.10f\n",temp.x,temp.y,R);
  if(check(Circle(origin+v3,R)))return true;

  p1=rotate(origin,p1,180);
  v1=p1-origin,v2=p2-origin;
  s=acos(dot(v1,v2)/(abs(v1)*abs(v2)))/2.0;
  x=(R/sin(s));
  v3=rotate(origin,p2,180-(s*360/(2*pi)))-origin;
  v3=v3*x/abs(v3);
  temp=origin+v3;
  //printf("%.10f %.10f %.10f\n",temp.x,temp.y,R);
  if(check(Circle(origin+v3,R)))return true;

  p2=rotate(origin,p2,180);
  v1=p1-origin,v2=p2-origin;
  s=acos(dot(v1,v2)/(abs(v1)*abs(v2)))/2.0;
  x=(R/sin(s));
  v3=rotate(origin,p1,180-(s*360/(2*pi)))-origin;
  v3=v3*x/abs(v3);
  temp=origin+v3;
  //printf("%.10f %.10f %.10f\n",temp.x,temp.y,R);
  if(check(Circle(origin+v3,R)))return true;

  p1=rotate(origin,p1,180);
  v1=p1-origin,v2=p2-origin;
  s=acos(dot(v1,v2)/(abs(v1)*abs(v2)))/2.0;
  x=(R/sin(s));
  v3=rotate(origin,p2,180-(s*360/(2*pi)))-origin;
  v3=v3*x/abs(v3);
  temp=origin+v3;
  //printf("%.10f %.10f %.10f\n",temp.x,temp.y,R);
  if(check(Circle(origin+v3,R)))return true;

  return false;
}

int main()
{
  int a,b,c,d,e,R;

  while(1){
    cin>>w>>h>>n>>R;
    if(h+w+n+R==0)break;
    vs.clear();
    vl.clear();
    vpl.clear();
    vs.push_back(Line(Point(0,0),Point(0,h)));
    vs.push_back(Line(Point(0,h),Point(w,h)));
    vs.push_back(Line(Point(w,h),Point(w,0)));
    vs.push_back(Line(Point(w,0),Point(0,0)));

    for(int i=0;i<n;i++){
      cin>>a>>b>>c>>d>>e;
      Line L=Line(Point(a,b),Point(c,d));
      vl.push_back(mp(L,e));
      vpl.push_back(getParalellLine(L,e));
    }
    
    string ans="No";
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
	if(check(vpl[i].f,vpl[j].f,R))ans="Yes";
	if(check(vpl[i].f,vpl[j].s,R))ans="Yes";
	if(check(vpl[i].s,vpl[j].f,R))ans="Yes";
	if(check(vpl[i].s,vpl[j].s,R))ans="Yes";
      }
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<4;j++){
	if(check(vpl[i].f,vs[j],R))ans="Yes";
	if(check(vpl[i].s,vs[j],R))ans="Yes";      
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1320