After many years of obscurity, the well known mobile game Flappy Bird has finally become downloadable again and Stefan decided to install it on his mobile phone in a quest to relive his old childhood days.
In this version, we are given pairs of towers, which can be represented as a grid of lines and an infinite number of columns (unlike the original version of the game, the towers are oriented horizontally, rather than vertically). In this grid, we know for each of the lines the interval of positions which are accessible by our bird and we want to know whether the bird can win the game, if the player plays the game perfectly.
In order for a bird to pass a pair of towers, it has to be able to move from the current position to any position from the next pair of towers, without having to touch any walls. Furthermore, we will assume that the bird has an infinite speed (it can move instantly to any point from the next pair of free spaces, as long as this is physically possible).
Input data
The first line of the input contains , the number of pairs of towers.
The next lines of the input contain two integers each, and , representing that the free spaces are between columns and .
Output data
On the first line of the output we will print YES
or NO
based on whether the bird can win the game or not.
Constraints and clarifications
- All tests are grouped in a single group worth points.
Example 1
stdin
5
3 6
4 7
2 4
4 5
1 5
stdout
YES
Example 2
stdin
4
4 7
5 6
1 3
3 6
stdout
NO