#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Point{
	Point(double arg_x,double arg_y){
		x = arg_x;
		y = arg_y;
	}

	Point(){
		x = y = 0.0;
	}

	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 a){ return Point(a*x,a*y); }
	Point operator / (double a){ return Point(x/a,y/a); }

	double abs(){ return sqrt(norm()); }
	double norm(){ return x*x + y*y; }

	bool operator<(const Point &p) const{
		return x != p.x? x < p.x: y < p.y;
	}

	bool operator == (const Point &p) const{
		return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
	}

	double x,y;
};
typedef Point Vector;

struct Circle{
	Point center;
	double r;
};

struct Line{
	Point p[2];
	Line(Point p1,Point p2){
		p[0] = p1;
		p[1] = p2;
		diff = 0;
	}
	Line(){
		diff = 0;
	}
	double diff;
};

int N;
double W,H,R;
vector<Line> WALL,LINE,CIRCLE_WALL,CIRCLE_LINE[105];

double norm(Vector a){
	return a.x*a.x+a.y*a.y;
}

double abs(Vector a){
	return sqrt(norm(a));
}

double cross(Vector a,Vector b){
    return a.x*b.y-a.y*b.x;
}

double dot(Vector a,Vector b){
    return a.x*b.x + a.y*b.y;
}


//交点を求める関数
Point calc_Cross_Point(double x1,double x2,double x3,double x4,double y1,double y2,double y3,double y4){
	Point ret;
	ret.x = ((x2-x1)*(y3*(x4-x3)+x3*(y3-y4))-(x4-x3)*(y1*(x2-x1)+x1*(y1-y2)))/((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1));
	if(x1 != x2){
		ret.y = ((y2-y1)*ret.x+y1*(x2-x1)+x1*(y1-y2))/(x2-x1);
	}else{
		ret.y = ((y4-y3)*ret.x+y3*(x4-x3)+x3*(y3-y4))/(x4-x3);
	}
	return ret;
}

//インタフェース関数
Point calc_Cross_Point(Point a,Point b,Point c,Point d){
	return calc_Cross_Point(a.x,b.x,c.x,d.x,a.y,b.y,c.y,d.y);
}

Point calc_Cross_Point(Line A,Line B){

	return calc_Cross_Point(A.p[0],A.p[1],B.p[0],B.p[1]);
}

Point calc_minus(Point a,Point b){
    Point ret;

    ret.x = a.x-b.x;
    ret.y = a.y-b.y;

    return ret;
}

double calc_len(Vector a){
    return sqrt(a.x*a.x+a.y*a.y);
}

//点と直線の距離(ただし、直線が無限長)
double calc_dist1(Line line,Point point){
    return abs(cross(line.p[1]-line.p[0],point-line.p[0]))/abs(line.p[1]-line.p[0]);
}

bool rangeCheck(Point point){

	return point.x >= R-EPS && point.x <= W-R+EPS && point.y >= R-EPS && point.y <= H-R+EPS;
}

bool is_OK(Point cross_point){

	if(!rangeCheck(cross_point))return false;

	//警告線と交差していないか調べる
	for(int c = 0; c < N; c++){

		double tmp_dist =  calc_dist1(LINE[c],cross_point);

		if(tmp_dist+EPS < R+LINE[c].diff){

			return false;
		}
	}

	//壁と交差していないか調べる
	for(int c = 0; c < 4; c++){

		double tmp_dist =  calc_dist1(WALL[c],cross_point);

		if(tmp_dist+EPS < R){

			return false;
		}
	}

	return true;
}


double calc_slope(Line A){

	if(fabs(A.p[0].x-A.p[1].x) < EPS){

		return DBL_MAX;

	}else if(fabs(A.p[0].y-A.p[1].y) < EPS){

		return 0;

	}else{

		return (A.p[0].y-A.p[1].y)/(A.p[0].x-A.p[1].x);
	}
}

bool is_Cross(Line A,Line B){

	return fabs(calc_slope(A)-calc_slope(B)) > EPS;
}

void func(){

	WALL.clear();
	LINE.clear();
	CIRCLE_WALL.clear();

	for(int i = 0; i < N; i++){

		CIRCLE_LINE[i].clear();
	}

	WALL.push_back(Line(Point(0,H),Point(0,0)));
	WALL.push_back(Line(Point(0,0),Point(W,0)));
	WALL.push_back(Line(Point(W,0),Point(W,H)));
	WALL.push_back(Line(Point(W,H),Point(0,H)));

	CIRCLE_WALL.push_back(Line(Point(R,H),Point(R,0)));
	CIRCLE_WALL.push_back(Line(Point(0,R),Point(W,R)));
	CIRCLE_WALL.push_back(Line(Point(W-R,0),Point(W-R,H)));
	CIRCLE_WALL.push_back(Line(Point(W,H-R),Point(0,H-R)));

	double diff;

	for(int i = 0; i < N; i++){

		Line tmp_line;

		scanf("%lf %lf %lf %lf %lf",&tmp_line.p[0].x,&tmp_line.p[0].y,&tmp_line.p[1].x,&tmp_line.p[1].y,&tmp_line.diff);
		LINE.push_back(tmp_line);

		//円を求めるため、平行移動した直線をあらかじめ求めておく

		Line top_line,under_line;

		if(fabs(tmp_line.p[0].x-tmp_line.p[1].x) < EPS){ //垂直な線分

			diff = tmp_line.diff+R;

			//p_top,p_underの設定
			top_line.p[0].x = tmp_line.p[0].x+diff;
			top_line.p[0].y = tmp_line.p[0].y;
			top_line.p[1].x = tmp_line.p[1].x+diff;
			top_line.p[1].y = tmp_line.p[1].y;

			CIRCLE_LINE[i].push_back(top_line);

			under_line.p[0].x = tmp_line.p[0].x-diff;
			under_line.p[0].y = tmp_line.p[0].y;
			under_line.p[1].x = tmp_line.p[1].x-diff;
			under_line.p[1].y = tmp_line.p[1].y;

			CIRCLE_LINE[i].push_back(under_line);

		}else{

			double slope = (tmp_line.p[1].y-tmp_line.p[0].y)/(tmp_line.p[1].x-tmp_line.p[0].x);

			diff = sqrt(slope*slope+1)*(R+tmp_line.diff);

			//p_top,p_underの設定
			top_line.p[0].x = tmp_line.p[0].x;
			top_line.p[0].y = tmp_line.p[0].y+diff;
			top_line.p[1].x = tmp_line.p[1].x;
			top_line.p[1].y = tmp_line.p[1].y+diff;

			CIRCLE_LINE[i].push_back(top_line);

			under_line.p[0].x = tmp_line.p[0].x;
			under_line.p[0].y = tmp_line.p[0].y-diff;
			under_line.p[1].x = tmp_line.p[1].x;
			under_line.p[1].y = tmp_line.p[1].y-diff;

			CIRCLE_LINE[i].push_back(under_line);
		}
	}

	//任意の2つの警告線について試す
	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++){
			if(k == i)continue;

			for(int a = 0; a < 2; a++){
				for(int b = 0; b < 2; b++){

					if(!is_Cross(CIRCLE_LINE[i][a],CIRCLE_LINE[k][b]))continue;

					Point cross_point = calc_Cross_Point(CIRCLE_LINE[i][a],CIRCLE_LINE[k][b]);

					if(is_OK(cross_point)){

						printf("Yes\n");
						return;
					}
				}
			}
		}
	}


	//壁と壁
	for(int i = 0; i < 3; i++){
		for(int k = i+1; k < 4; k++){

			if(!is_Cross(CIRCLE_WALL[i],CIRCLE_WALL[k]))continue;

			Point cross_point = calc_Cross_Point(CIRCLE_WALL[i],CIRCLE_WALL[k]);

			if(is_OK(cross_point)){

				printf("Yes\n");
				return;
			}
		}
	}

	//任意の壁と、1つの警告線について試す
	for(int i = 0; i < 4; i++){
		for(int k = 0; k < N; k++){
			for(int a = 0; a < 2; a++){

				if(!is_Cross(CIRCLE_WALL[i],CIRCLE_LINE[k][a]))continue;

				Point cross_point = calc_Cross_Point(CIRCLE_WALL[i],CIRCLE_LINE[k][a]);

				if(is_OK(cross_point)){

					printf("Yes\n");
					return;
				}
			}
		}
	}

	printf("No\n");
}

int main(){

	int input_W,input_H,input_R;

	while(true){

		scanf("%d %d %d %d",&input_W,&input_H,&N,&input_R);
		if(input_W == 0 && input_H == 0 && N == 0 && input_R == 0)break;

		W = input_W,H = input_H,R = input_R;

		func();

	}

	return 0;
}



Measured memory_bytes: 3248