Exactly people, numbered from to , visited a museum. Each person entered once and later left once. All arrival and departure times were distinct.
For each person , you are given two recorded values:
Determine whether there is an order of arrivals and departures for which all the recorded values are correct.
Output Yes if all records can be correct simultaneously; otherwise, output No.
Letter capitalization is ignored: YES, yes, and yEs are all accepted as Yes.
The second person must enter after the first person leaves. Therefore, the first person must have , which contradicts the record.