In a sequence, there are rectangles. Each rectangle can either be rotated by degrees or left in its original orientation. Rotating a rectangle swaps its height and width. You may rotate any number of rectangles, including all or none, but the order of rectangles in the sequence must remain unchanged.
Determine whether it is possible to rotate the rectangles so that their heights appear in non-increasing order. That is, after any rotations, the height of each rectangle should be less than or equal to the height of the preceding rectangle.
The first line contains a single integer (1 \le n \le 10^5) — the number of rectangles.
Each of the following lines contains two integers w_i, h_i (1 \le w_i, h_i \le 10^9) — the width and height of the -th rectangle.
Print YES if it is possible to arrange the rectangles so that their heights are in non-increasing order; otherwise, print NO.
Example 1
Example 2