Problem: Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board, get the pie and win. After Volodya's move, Vlad bans some edge at the border of the board of length 1 (between two knots of the board) so that Volodya is not able to move the pie outside the board through this edge anymore. The question is: will Volodya win this game? We suppose both players follow the optimal strategy.

<image>

Input

First line contains 3 integers, separated by space: 1 ≤ n, m ≤ 100 — dimensions of the board and 0 ≤ k ≤ 100 — the number of pies. Each of the next k lines contains 2 integers, separated by space: 1 ≤ x ≤ n, 1 ≤ y ≤ m — coordinates of the corresponding pie. There could be more than one pie at a cell. 

Output

Output only one word: "YES" — if Volodya wins, "NO" — otherwise.

Examples

Input

2 2 1
1 2


Output

YES

Input

3 4 0


Output

NO

Input

100 50 2
50 25
50 25


Output

NO

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					try {
						if (new File("input.txt").exists())
							System.setIn(new FileInputStream("input.txt"));
					} catch (SecurityException e) {}
					new Main().run();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start(); 
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");
	
	int N;
	int M;
	int K;
	char[][] map;
	
	int[] cx;
	int[] cy;
	
	int[] cornx = new int [4];
	int[] corny = new int [4];
	
	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		
		N = nextInt();
		M = nextInt();
		
		K = nextInt();
		map = new char [N][M];
		cx = new int [K];
		cy = new int [K];
		for (int i = 0; i < K; i++) {
			cx[i] = nextInt() - 1;
			cy[i] = nextInt() - 1;
			map[cx[i]][cy[i]] = '*';
		}
		
		cornx[1] = N - 1;
		corny[1] = 0;
		cornx[2] = 0;
		corny[2] = M - 1;
		cornx[3] = N - 1;
		corny[3] = M - 1;
		
		
		dist = new int [N][M];
		queue = new ArrayDeque<Integer> (N * M);
		cdist = new int [4][N][M];
		for (int i = 0; i < 4; i++)
			cbfs(i);
		for (int i = 0; i < K; i++) {
			if (can(i)) {
				out.println("YES");
				out.close();
				return;
			}
		}
		
		out.println("NO");
		out.close();
	}

	int[][] dist;
	int[][][] cdist;
	
	Queue<Integer> queue;
	
	int[] dx = { -1, 0, 1, 0};
	int[] dy = { 0, -1, 0, 1};
	
	boolean can(int cake) {
		int x = cx[cake];
		int y = cy[cake];
		bfs(x, y);
		
		for (int cx = 0; cx < N; cx++) {
			if (win(cx, 0))
				return true;
			if (win(cx, M - 1))
				return true;
		}
		
		for (int cy = 0; cy < M; cy++) {
			if (win(0, cy))
				return true;
			if (win(N - 1, cy))
				return true;
		}
		
		return false;
	}

	boolean win(int x, int y) {
		if (dist[x][y] == -1)
			return false;
		int d = dist[x][y];
		if (d == 0)
			return true;
		int dr = d - 1;
		int cr = 0;
		for (int i = 0; i < 4; i++)
			if (cdist[i][x][y] != -1)
				cr++;
//		if (d == 1 && cr > 0)
//			return true;
		if (dr < cr)
			return true;
		return false;
	}
	
	void bfs(int x, int y) {
		for (int[] a : dist)
			fill(a, -1);
		dist[x][y] = 0;
		queue.clear();
		queue.add(x * 100 + y);
		
		while (!queue.isEmpty()) {
			int state = queue.poll();
			int cx = state / 100;
			int cy = state % 100;
			for (int d = 0; d < dx.length; d++) {
				int nx = cx + dx[d];
				int ny = cy + dy[d];
				if (good(nx, ny)) {
					dist[nx][ny] = dist[cx][cy] + 1;
					queue.add(nx * 100 + ny);
				}
			}
		}
	}
	
	void cbfs(int corner) {
		int x = cornx[corner];
		int y = corny[corner];
		int[][] dist = cdist[corner];
		for (int[] a : dist)
			fill(a, -1);
		
		dist[x][y] = 0;
		queue.clear();
		queue.add(x * 100 + y);
		
		while (!queue.isEmpty()) {
			int state = queue.poll();
			int cx = state / 100;
			int cy = state % 100;
			for (int d = 0; d < dx.length; d++) {
				int nx = cx + dx[d];
				int ny = cy + dy[d];
				if (cgood(nx, ny) && dist[nx][ny] == -1) {
					dist[nx][ny] = dist[cx][cy] + 1;
					queue.add(nx * 100 + ny);
				}
			}
		}
	}

	boolean cgood(int x, int y) {
		return 0 <= x && x < N && 0 <= y && y < M && map[x][y] != '*' && (x == 0 || y == 0 || x == N - 1 || y == M - 1);
	}

	boolean good(int x, int y) {
		return 0 <= x && x < N && 0 <= y && y < M && map[x][y] != '*' && dist[x][y] == -1;
	}

	String nextToken() throws IOException {
		while (!st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		
		return st.nextToken();
	}
	
	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	
	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}
	
	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	
	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}
	
	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			
			if (s == null) {
				return true;
			}
			
			st = new StringTokenizer(s);
		}
		
		return false;
	}
}