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.util.Scanner;


/**
 * 
 * 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.
 * 
 * 输入描述: 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 only one word: "YES" — if Volodya wins, "NO" — otherwise.
 * 
 * 示例1 输入 2 2 1 1 2 3 4 0 100 50 2 50 25 50 25 输出 YESNONO
 * 
 * Volodya和Vlad玩下面的游戏。n × m板的单元有k饼。每一回合沃洛佳都将一个馅饼移动到邻近（旁边）的细胞。
 * 如果馅饼位于棋盘的边缘，那么Volodya可以将它移到棋盘外，获得馅饼并获胜。在Volodya的移动之后，
 * Vlad禁止在长度为1的板的边缘（在两节板之间）的一些边缘，这样Volodya就不能再通过这个边缘将盘子移出板外了。
 * 问题是：沃洛佳会赢得这场比赛吗？我们假设两位球员都遵循最佳策略。
 * 
 * 输入描述： 第一行包括3点的整数，由空格隔开：1≤ Ñ， 米 ≤100 -电路板的尺寸和0≤ ķ ≤100 -馅饼的数量。
 * 每个下一个的ķ线包含2个整数，由空格隔开：1≤ X ≤ Ñ，1≤ ÿ ≤ 米 -相应的馅饼的坐标。一个小区可能有不止一个馅饼。
 * 
 * 
 * 
 * 输出描述： 只输出一个单词：“ YES ” - 如果Volodya获胜，“ NO ” - 否则。
 * 
 * 示例1 输入 2 2 1 1 2 3 4 0 100 50 2 50 25 50 25 输出 YESNONO
 * 
 * @author liao
 *
 */
public class Main {
		public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] line;
		while (sc.hasNext()) {
			line = sc.nextLine().split(" ");
			Integer n = Integer.parseInt(line[0]);
			Integer m = Integer.parseInt(line[1]);
			Integer k = Integer.parseInt(line[2]);
			Integer[] x = new Integer[k];
			Integer[] y = new Integer[k];
			for (int i = 0; i < k; i++) {
				line = sc.nextLine().split(" ");
				x[i] = Integer.parseInt(line[0]);
				y[i] = Integer.parseInt(line[1]);
			}
			if(process(x,y, m, n)){
                System.out.print("YES");
            }else{
                System.out.print("NO");
            }
		}
		sc.close();
	}

	private static boolean process(Integer[] x, Integer[] y, Integer m, Integer n) {
		for (int i = 0; i < y.length; i++) {
			if (x[i] <= 5 || x[i] >= n - 4 || y[i] <= 5 || y[i] >= m - 4) {
				return true;
			}
		}
		return false;
	}
}