#K39912. Reservation Overlap Checker

    ID: 26526 Type: Default 1000ms 256MiB

Reservation Overlap Checker

Reservation Overlap Checker

You are given an integer N representing the number of existing reservations, followed by N reservations. Each reservation is provided in the format HH:MM HH:MM (start and end time in 24-hour format). After that, a new reservation is given in the same format.

Your task is to determine whether the new reservation can be scheduled without any conflict. Two reservations do not conflict if the end time of one is exactly equal to the start time of the other. In other words, for the new reservation with start time \(t_{new\_start}\) and end time \(t_{new\_end}\), and for each existing reservation with start time s and end time e, the following condition must hold:

$$t_{new\_end} \leq s \quad \text{or} \quad t_{new\_start} \geq e.$$

inputFormat

The input is read from stdin. The first line contains an integer N representing the number of existing reservations.

The next N lines each contain two strings representing the start and end times (in 24-hour format "HH:MM") of an existing reservation.

The last line contains two strings representing the start and end times of the new reservation.

outputFormat

Output a single line to stdout: YES if the new reservation can be made without conflicting with any existing reservation, otherwise output NO.

## sample
3
09:00 10:30
10:30 12:00
13:00 15:00
12:00 13:00
YES