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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<b?(a=b,1):0)
#define chmin(a,b) (a>b?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    // if (abs(a-b)<EPS) return 0;
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
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);
}
struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
  L() {}
};

ostream &operator<<(ostream &os, const L &l) {
  os << l[0] << "->" << l[1];
  return os;
}
int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

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 intersectLS(const L &l, const L &s) {
  return cross(l[1]-l[0], s[0]-l[0])*       // s[0] is left of l
         cross(l[1]-l[0], s[1]-l[0]) < EPS; // s[1] is right of l
}
bool intersectLP(const L &l, const P &p) {
  return abs(cross(l[1]-p, l[0]-p)) < EPS;
}
bool intersectSS(const L &s, const L &t) {
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}
bool intersectSS2(const L &s, const L &t) { // 接しているやつは交差と考えない
  REP(i, 2) {
    if (ccw(s[0], s[1], t[i]) == 0) {
      int c = ccw(s[0],s[1],t[!i]);
      if (s[0] == t[i]) {
        if (c!=-2&&c) return 0;
      } else if (s[1] == t[i]) {
        if (c!=2&&c) return 0;
      } else if (abs(c)==1) return 0;
    }
  }
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}
bool intersectSP(const L &s, const P &p) {
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}

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 + P(2,0) * (projection(l, p) - p);
}
double distanceLP(const L &l, const P &p) {
  return abs(p - projection(l, p));
}
double distanceLL(const L &l, const L &m) {
  return intersectLL(l, m) ? 0 : distanceLP(l, m[0]);
}
double istanceLS(const L &l, const L &s) {
  if (intersectLS(l, s)) return 0;
  return min(distanceLP(l, s[0]), distanceLP(l, s[1]));
}
double distanceSP(const L &s, const P &p) {
  const P r = projection(s, p);
  if (intersectSP(s, r)) return abs(r - p);
  return min(abs(s[0] - p), abs(s[1] - p));
}
double distanceSS(const L &s, const L &t) {
  if (intersectSS(s, t)) return 0;
  return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),
             min(distanceSP(t, s[0]), distanceSP(t, s[1])));
}
P crosspoint(const L &l, const L &m, bool &same) {
  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) {
    same = 1;
    return m[0]; // same line
  }
  if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0] + B / A * (m[1] - m[0]);
}
double angle(const P &a, const P &b) {        // ベクトルａからみたベクトルｂの角度の計算[0,2pi)
  double ret = arg(b)-arg(a);
  return (ret>=0) ? ret : ret + 2*PI;
}
double angle2(const P &a, const P &b) { // ベクトルaとベクトルbの間の角度
  return min(angle(a,b), angle(b,a));
}

L ls[100][2];
double w,h;
int n,r;

bool check(const P &p) {
  double x = p.real();
  double y = p.imag();
  // cout << p << endl;
  if (x < r-EPS || x > w-r+EPS) return 0;
  if (y < r-EPS || y > h-r+EPS) return 0;
  REP(i,n) {
    if (min(distanceLP(ls[i][0],p), distanceLP(ls[i][1],p)) < r-EPS) return 0;
    if (ccw(ls[i][0][0], ls[i][0][1], p) != 1 &&
        ccw(ls[i][1][0], ls[i][1][1], p) != -1) return 0;
  }
  return 1;
}

bool lineline2(const P &o, const P &d1, const P &d2) {
  double ang = angle(d1,d2);
  assert(ang<PI);
  ang /= 2;
  double l = r / sin(ang);
  P d = (d1 + d2) * P(0.5,0);
  d *= l / abs(d);
  return check(o+d);
}

bool lineline(const L &l1, const L &l2) {
  if (!intersectLL(l1,l2)) return 0;
  bool same = 0;
  P o = crosspoint(l1,l2,same);
  if (same) return 0;
  P d1 = l1[1]-l1[0];
  P d2 = l2[1]-l2[0];
  d1 /= abs(d1);
  d2 /= abs(d2);
  if (angle(d1,d2)>PI) d2 = -d2;
  bool res = 0;
  res |= lineline2(o, d1, d2);
  res |= lineline2(o, d2, -d1);
  res |= lineline2(o, -d1, -d2);
  res |= lineline2(o, -d2, d1);
  return res;
}


int main() {
  while(cin>>w>>h>>n>>r,w||h||n||r) {
    REP(i,n) {
      P p,q;
      double t;
      cin>>p.real()>>p.imag()>>q.real()>>q.imag()>>t;
      P d = q-p;
      d *= P(0,1);
      d *= t/abs(d);
      ls[i][0] = L(p+d,q+d);
      ls[i][1] = L(p-d,q-d);
      // cout << ls[i][0] << " " << ls[i][1] << endl;
    }
    P wallp[4] = {P(0,0),P(w,0),P(w,h),P(0,h)};
    L wall[4];
    REP(i,4) wall[i] = L(wallp[i], wallp[(i+1)%4]);
    bool ans = 0;
    REP(i,n) {
      REP(j,i) REP(k1,2) REP(k2,2)
        ans |= lineline(ls[i][k1], ls[j][k2]);
      REP(k,2) REP(j,4)
        ans |= lineline(ls[i][k], wall[j]);
    }
    REP(i,4) {
      ans |= lineline(wall[i], wall[(i+1)%4]);
    }
    cout << (ans?"Yes":"No") << endl;
  }
}

Measured memory_bytes: 1372