Snuke is playing a puzzle game. In this game, you are given a rectangular board of dimensions R × C, filled with numbers. Each integer i from 1 through N is written twice, at the coordinates (x_{i,1},y_{i,1}) and (x_{i,2},y_{i,2}).

The objective is to draw a curve connecting the pair of points where the same integer is written, for every integer from 1 through N. Here, the curves may not go outside the board or cross each other.

Determine whether this is possible.

Constraints

* 1 ≤ R,C ≤ 10^8
* 1 ≤ N ≤ 10^5
* 0 ≤ x_{i,1},x_{i,2} ≤ R(1 ≤ i ≤ N)
* 0 ≤ y_{i,1},y_{i,2} ≤ C(1 ≤ i ≤ N)
* All given points are distinct.
* All input values are integers.

Input

Input is given from Standard Input in the following format:


R C N
x_{1,1} y_{1,1} x_{1,2} y_{1,2}
:
x_{N,1} y_{N,1} x_{N,2} y_{N,2}


Output

Print `YES` if the objective is achievable; print `NO` otherwise.

Examples

Input

4 2 3
0 1 3 1
1 1 4 1
2 0 2 2


Output

YES


Input

2 2 4
0 0 2 2
2 0 0 1
0 2 1 2
1 1 2 1


Output

NO


Input

5 5 7
0 0 2 4
2 3 4 5
3 5 5 2
5 5 5 4
0 3 5 1
2 2 4 4
0 5 4 1


Output

YES


Input

1 1 2
0 0 1 1
1 0 0 1


Output

NO
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

  class Pair {

    private final int x1, y1, x2, y2;

    Pair(int x1, int y1, int x2, int y2) {
      this.x1 = x1;
      this.y1 = y1;
      this.x2 = x2;
      this.y2 = y2;
    }
  }

  class Edge {

    final long from, to;

    Edge(long from, long to) {
      this.from = from;
      this.to = to;
    }
  }

  private int R, C;

  private void solve(FastScanner in, PrintWriter out) {
    R = in.nextInt();
    C = in.nextInt();
    int N = in.nextInt();

    ArrayList<Edge> edges = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      Pair pair = new Pair(in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt());
      if (onBorder(pair.x1, pair.y1) && onBorder(pair.x2, pair.y2)) {
        long c1 = convert(pair.x1, pair.y1);
        long c2 = convert(pair.x2, pair.y2);

        long l = Math.max(c1, c2);
        long s = Math.min(c1, c2);

        Edge edge = new Edge(s, l);
        edges.add(edge);
      }
    }

    edges.sort((o1, o2) -> Long.signum(o1.from - o2.from));

    ArrayDeque<Long> stop = new ArrayDeque<>();
    for (Edge edge : edges) {
      while (!stop.isEmpty() && stop.peekFirst() < edge.from) {
        stop.pollFirst();
      }
      if (!stop.isEmpty() && stop.peekFirst() < edge.to) {
        out.println("NO");
        return;
      }
      stop.addFirst(edge.to);
    }

    out.println("YES");
  }

  private long convert(long x, long y) {
    if (y == 0) {
      return x;
    }
    if (x == R) {
      return R + y;
    }
    if (y == C) {
      return R + C + (R - x);
    }
    return R + C + R + (C - y);
  }

  private boolean onBorder(int x, int y) {
    return (x == 0 || x == R) || (y == 0 || y == C);

  }

  class UnionFind {

    // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
    private int[] par;
    // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
    private int[] sizes;

    // 木の数
    private int size;

    UnionFind(int n) {
      par = new int[n];
      sizes = new int[n];
      size = n;
      Arrays.fill(sizes, 1);
      // 最初は全てのデータiがグループiに存在するものとして初期化
      for (int i = 0; i < n; i++) {
        par[i] = i;
      }
    }

    /**
     * データxが属する木の根を得る
     */
    int find(int x) {
      if (x == par[x]) {
        return x;
      }
      return par[x] = find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
    }

    /**
     * 2つのデータx, yが属する木をマージする。
     * マージが必要なら true を返す
     */
    boolean unite(int x, int y) {
      // データの根ノードを得る
      x = find(x);
      y = find(y);

      // 既に同じ木に属しているならマージしない
      if (x == y) {
        return false;
      }

      // xの木がyの木より大きくなるようにする
      if (sizes[x] < sizes[y]) {
        int tx = x;
        x = y;
        y = tx;
      }

      // xがyの親になるように連結する
      par[y] = x;
      sizes[x] += sizes[y];
      sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい

      size--;
      return true;
    }

    /**
     * 2つのデータx, yが属する木が同じならtrueを返す
     */
    boolean isSame(int x, int y) {
      return find(x) == find(y);
    }

    /**
     * データxが含まれる木の大きさを返す
     */
    int partialSizeOf(int x) {
      return sizes[find(x)];
    }

    /**
     * 木の数を返す
     */
    int size() {
      return size;
    }
  }

  public static void main(String[] args) {
    PrintWriter out = new PrintWriter(System.out);
    new Main().solve(new FastScanner(), out);
    out.close();
  }

  private static class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int bufferLength = 0;

    private boolean hasNextByte() {
      if (ptr < bufferLength) {
        return true;
      } else {
        ptr = 0;
        try {
          bufferLength = in.read(buffer);
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (bufferLength <= 0) {
          return false;
        }
      }
      return true;
    }

    private int readByte() {
      if (hasNextByte()) {
        return buffer[ptr++];
      } else {
        return -1;
      }
    }

    private static boolean isPrintableChar(int c) {
      return 33 <= c && c <= 126;
    }

    private void skipUnprintable() {
      while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
        ptr++;
      }
    }

    boolean hasNext() {
      skipUnprintable();
      return hasNextByte();
    }

    public String next() {
      if (!hasNext()) {
        throw new NoSuchElementException();
      }
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while (isPrintableChar(b)) {
        sb.appendCodePoint(b);
        b = readByte();
      }
      return sb.toString();
    }

    long nextLong() {
      if (!hasNext()) {
        throw new NoSuchElementException();
      }
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
        minus = true;
        b = readByte();
      }
      if (b < '0' || '9' < b) {
        throw new NumberFormatException();
      }
      while (true) {
        if ('0' <= b && b <= '9') {
          n *= 10;
          n += b - '0';
        } else if (b == -1 || !isPrintableChar(b)) {
          return minus ? -n : n;
        } else {
          throw new NumberFormatException();
        }
        b = readByte();
      }
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    double[] nextDoubleArray(int n) {
      double[] array = new double[n];
      for (int i = 0; i < n; i++) {
        array[i] = nextDouble();
      }
      return array;
    }

    double[][] nextDoubleMap(int n, int m) {
      double[][] map = new double[n][];
      for (int i = 0; i < n; i++) {
        map[i] = nextDoubleArray(m);
      }
      return map;
    }

    public int nextInt() {
      return (int) nextLong();
    }

    public int[] nextIntArray(int n) {
      int[] array = new int[n];
      for (int i = 0; i < n; i++) {
        array[i] = nextInt();
      }
      return array;
    }

    public long[] nextLongArray(int n) {
      long[] array = new long[n];
      for (int i = 0; i < n; i++) {
        array[i] = nextLong();
      }
      return array;
    }

    public String[] nextStringArray(int n) {
      String[] array = new String[n];
      for (int i = 0; i < n; i++) {
        array[i] = next();
      }
      return array;
    }

    public char[][] nextCharMap(int n) {
      char[][] array = new char[n][];
      for (int i = 0; i < n; i++) {
        array[i] = next().toCharArray();
      }
      return array;
    }

    public int[][] nextIntMap(int n, int m) {
      int[][] map = new int[n][];
      for (int i = 0; i < n; i++) {
        map[i] = nextIntArray(m);
      }
      return map;
    }
  }
}
