Under construction

Still being built. Things may change

Jumbled Scoreboards

Interview

Time limit1sMemory limit1024 MB

Summary
Given n score pairs in the order the pictures arrived, check whether both teams' scores never decrease from one picture to the next.
Level

Easy2 of 10

Topics
Array, Implementation
Solved
No attempts yet

Statement

You were so excited 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 as possible into the opponent's goal. But you fell ill and could not join your friends. Luckily, your friends took many pictures during the match and sent you all of them after it ended.

The messaging app uploads and downloads pictures in parallel, so you wonder whether they arrived in chronological order. The scoreboard in each picture is unique, and a team's score can only increase over time, so the scoreboards show the order. You feel too sick to check it by hand, so you decide to write a program that checks temporal consistency from the scoreboards in the pictures.

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

Input

The first line contains an integer nn (1≤n≤1001\leq n\leq 100), the number of pictures you received.

Each of the next nn lines contains two integers aa and bb (0≤a,b≤1000 \leq a,b \leq 100), the scores of the two teams in one of the pictures.

Every pair of scores (a,b)(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

Print "yes" if the scores are in chronological order, or "no" if they are not.

Examples3

  1. Example 1

    Input
    4
    1 0
    2 0
    4 0
    4 1
    
    Expected output
    yes
    
  2. Example 2

    Input
    3
    0 0
    1 0
    0 2
    
    Expected output
    no
    
  3. Example 3

    Input
    5
    1 2
    0 0
    4 3
    2 3
    5 5
    
    Expected output
    no