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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

class Parser {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static final Iterator<String> stringIterator = br.lines().iterator();
    private static final Deque<String> inputs = new ArrayDeque<>();

    void fill() throws IOException {
        if(inputs.isEmpty()){
            if(!stringIterator.hasNext()) throw new IOException();
            inputs.addAll(Arrays.asList(stringIterator.next().split(" ")));
        }
    }

    Integer parseInt() throws IOException {
        fill();
        if(!inputs.isEmpty()) {
            return Integer.parseInt(inputs.pollFirst());
        }
        throw new IOException();
    }

    Double parseDouble() throws IOException {
        fill();
        if(!inputs.isEmpty()) {
            return Double.parseDouble(inputs.pollFirst());
        }
        throw new IOException();
    }

    String parseString() throws IOException {
        fill();
        return inputs.pollFirst();
    }

}

public class Main {

    static class Point implements Comparable<Point> {
        int x;
        int y;
        int idx;

        public Point(int x, int y, int idx){
            this.x = x;
            this.y = y;
            this.idx = idx;
        }

        @Override
        public int compareTo(Point o) {
            if(y != o.y){
                return Integer.compare(y, o.y);
            }
            return Integer.compare(x, o.x);
        }

        @Override
        public boolean equals(Object obj) {
            if(!(obj instanceof Point)){
                return false;
            }

            Point o = (Point)obj;

            return x == o.x && y == o.y && idx == o.idx;
        }
    }

    public static void main(String[] args) throws IOException {

        Parser parser = new Parser();
        int R = parser.parseInt();
        int C = parser.parseInt();
        int N = parser.parseInt();

        List<Point> externalPoints = new ArrayList<>();
        for(int i = 0; i < N; i++){
            int sy = parser.parseInt();
            int sx = parser.parseInt();
            int ey = parser.parseInt();
            int ex = parser.parseInt();

            if((sx != 0 && sx != C) && (sy != 0 && sy != R)) continue;
            if((ex != 0 && ex != C) && (ey != 0 && ey != R)) continue;

            externalPoints.add(new Point(sx, sy, i));
            externalPoints.add(new Point(ex, ey, i));
        }

        Stream<Point> pointStream = Stream.of(externalPoints.stream()
                .filter(p -> p.y == 0)
                .sorted(),
                externalPoints.stream()
                .filter(p -> p.x == C)
                .sorted(),
                externalPoints.stream()
                .filter(p -> p.y == R)
                .sorted(Comparator.reverseOrder()),
                externalPoints.stream()
                .filter(p -> p.x == 0)
                .sorted(Comparator.reverseOrder())).flatMap(i -> i);

        List<Point> sortedExternalPoints = pointStream.distinct().collect(Collectors.toList());

        Stack<Point> pointStack = new Stack<>();
        for(Point p : sortedExternalPoints){
            if(pointStack.isEmpty() || pointStack.peek().idx != p.idx){
                pointStack.push(p);
            }else pointStack.pop();
        }

        if(pointStack.empty()){
            System.out.print("YES");
        }else{
            System.out.print("NO");
        }
    }
}
