import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int r, c, n; readV(r, c, n);

  struct P { int s, i; }
  P[] p;

  auto addP(int x, int y, int i)
  {
    if (y == 0) return P(x, i);
    else if (x == c) return P(c+y, i);
    else if (y == r) return P(c+r+(c-x), i);
    else if (x == 0) return P(c+r+c+(r-y), i);
    return P(-1, -1);
  }

  foreach (i; 0..n) {
    int x1, y1, x2, y2; readV(x1, y1, x2, y2);
    
    auto p1 = addP(x1, y1, i);
    auto p2 = addP(x2, y2, i);
    if (p1.s >= 0 && p2.s >= 0) p ~= [p1, p2];
  }

  p.sort!"a.s < b.s";

  auto s = SList!int();
  foreach (pi; p)
    if (!s.empty && s.front == pi.i)
      s.removeFront();
    else
      s.insertFront(pi.i);

  writeln(s.empty ? "YES" : "NO");
}
