Hide

Problem E
Jumbled Scoreboards

/problems/jumbledscoreboards/file/statement/en/img-0001.jpg
One of the pictures that you received for the first sample input. CC BY 2.0 by Adam Baker on Flickr, modified

You were so hyped to attend the final game of the Ball And Paddle Competition, where the two best teams in the world compete to paddle as many balls into the opponent’s goal as possible. But alas, you fell ill, and cannot join your friends. Luckily, your friends took lots of pictures during the match, and after the match concluded, they sent you all the pictures that they have. Because the messaging app uploads and downloads the pictures in parallel, you are wondering whether you received them in chronological order. It looks like the scoreboards in each picture are unique, and knowing that the score of a team can only increase over time, you should be able to figure this out. Feeling too sick to check the order of the pictures manually, you decide to write a program that checks temporal consistency based on the scoreboards that are in the picture.

Given a list of intermediate scores from the match, determine whether the scores are in chronological order.

Input

The input consists of:

  • One line with an integer $n$ ($1\leq n\leq 100$), the number of pictures you received.

  • $n$ lines, each with two integers $a$ and $b$ ($0 \leq a,b \leq 100$), the scores of the two teams in one of the pictures.

Every pair of scores $(a, b)$ in the input is unique.

The order of the scores in the input is the order in which you received the pictures.

Output

Output “yes” if the scores are in chronological order, or “no” if they are not.

Sample Input 1 Sample Output 1
4
1 0
2 0
4 0
4 1
yes
Sample Input 2 Sample Output 2
3
0 0
1 0
0 2
no
Sample Input 3 Sample Output 3
5
1 2
0 0
4 3
2 3
5 5
no

Please log in to submit a solution to this problem

Log in