404497: GYM101521 A Shuttle Bus

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Shuttle Bustime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Alex is a driver of a shuttle bus whose working duty is to drive around Byteland and let the tourists do sightseeing there.

The territory of Byteland is strange which can be represent by an grid with exactly 2 rows and N columns. There are M churches on some cells in Byteland where sightseeing there are forbidden. On the other hand, there is an attraction in each of the remaining cells.

On each day, Alex drives the shuttle bus from the frontier of Byteland, which is the top-left corner of the 2 × N grid. The shuttle bus can travel from one cell to its adjacent cells which have a common side with it each time. Alex will drive the shuttle bus to visit all attractions. Undoubtedly, he cannot drive into the cells where the churches are located.

Alex does not want to make his tourists bored, so he hopes to visit all attractions, except the churches, exactly once. The tour can end in any cell. Given the length of the grid and the positions of the churches, determine whether Alex can do so successfully.

Input

The first line of contains 2 integers N, M, representing the length of the grid of Byteland and the number of churches there. (1 ≤ N ≤ 109, 1 ≤ M ≤ 5000)

The following M lines contains 2 integers ri, ci, representing the position of the ith church. (1 ≤ ri ≤ 2, 1 ≤ ci ≤ N)

The positions of the churches are distinct and no church will be located at the top-left corner of the grid.

Output

Please output Yes if Alex can visit all attractions except the churches exactly once and output No otherwise.

ExamplesInput
5 3
2 1
1 3
2 5
Output
Yes
Input
3 2
2 1
2 3
Output
No
Input
3 2
1 2
2 2
Output
No

加入题单

算法标签: