#include <bits/stdc++.h>

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef std::vector<long> LI;
typedef std::queue<long> QI;
#define rep(i,n) for(long i = 0; i < (long)n; ++i)
const double pi = M_PI;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct N001 {
   long n;
   std::vector<long> parents;
   std::vector<long> numbers;
   N001(long n_) : n(n_), parents(n+1, -1), numbers(n+1, -1) {
   }
};
long find(N001& s, long x) {
   if( s.parents[x] == -1 ) return x;
   return s.parents[x] = find(s, s.parents[x]);
}
bool same(N001& s, long x, long y) {
   return find(s, x) == find(s, y);
}
void unite(N001& s, long x, long y) {
   long x2 = find(s, x);
   long y2 = find(s, y);
   if( x2 == y2 ) return;
   if( not ( s.numbers[x2] <= s.numbers[y2] ) )
      std::swap(x2, y2);
   s.parents[x2] = y2;
   s.numbers[y2] += s.numbers[x2];
}


struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      long r, c, n; scan(r, c, n);
      std::swap(r, c);
      std::vector<long> corner[4];
      std::vector<std::pair<long, long>> edge[4];
      std::vector<bool> notRound(n, false);
      for(long i = 0; i < n; ++i) {
         for(long k = 0; k < 2; ++k) {
            long x, y; scan(x, y);
            if( false ) ;
            else if( x == 0 and y == 0 ) corner[0].push_back(i);
            else if( x == c and y == 0 ) corner[1].push_back(i);
            else if( x == c and y == r ) corner[2].push_back(i);
            else if( x == 0 and y == r ) corner[3].push_back(i);
            else if( y == 0 ) edge[0].push_back(std::make_pair(x, i));
            else if( x == c ) edge[1].push_back(std::make_pair(y, i));
            else if( y == r ) edge[2].push_back(std::make_pair(-x, i));
            else if( x == 0 ) edge[3].push_back(std::make_pair(-y, i));
            else {
               notRound[i] = true;
            }
         }
      }
      std::vector<long> zs;
      for(long k = 0; k < 4; ++k) {
         if( corner[k].size() != 0 ) zs.push_back(corner[k][0]);
         std::sort(edge[k].begin(), edge[k].end());
         for(auto e : edge[k]) {
            zs.push_back(e.second);
         }
      }
      std::vector<long> ts(n+1, 0);
      std::stack<long> stack;
      bool res = true;
      for(long z : zs) {
         if( notRound[z] ) continue;
         if( ts[z] == 0 ) {
            ts[z] = 1;
            stack.push(z);
            continue;
         }
         else {
            if( stack.top() == z ) {
               stack.pop();
               ts[z] = 0;
            }
            else {
               res = false;
               break;
            }
         }
      }
      puts(res ? "YES" : "NO");
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}



Measured memory_bytes: 7216