391. Mr. X
Time limit per test: 0.25 second(s)
Memory limit: 262144 kilobytes
input: standard
output: standard

Mr. X (he is famous for his 13 feats) has a piece of chequered paper. Some of the cells are marked with a special sign. He can fold the piece of paper anywhere along a line between two successive rows or columns. After the fold is performed, he considers a folded paper as a new piece of paper, so he may continue the folding process. Now Mr. X wonders whether it is possible to combine all the marked cells together performing some sequence of folds (marked cells must be all one under another, and no unmarked cell must be under or above the marked cells). So he asks for your help.
Input
The first line of the input file contains integers n, m and k — number of rows, columns and marked cells correspondingly (). Each of the following k lines describes one marked cell and contains two integer numbers xi and yi that are row and column indices (1 ≤ xi ≤ n, 1 ≤ yi ≤ m).
Output
If it is possible for Mr. X to combine all the marked cells together, output "YES", otherwise output "NO" (quotes for clarity).
Example(s)
sample input
sample output
4 4 4
1 1 
4 1
1 4
4 4
YES

sample input
sample output
4 4 3
1 1 
4 1
1 4
NO
