#K94487. Flower Bed Overlap

    ID: 38652 Type: Default 1000ms 256MiB

Flower Bed Overlap

Flower Bed Overlap

You are given a list of existing flower beds, each represented as an interval [a, b) with a < b. A new flower bed is also given as an interval [a_{new}, b_{new}). Your task is to determine whether the new flower bed overlaps with any of the existing ones.

Two intervals [a, b) and [c, d) are said to overlap if and only if

a &lt; d \quad \text{and} \quad c &lt; b.

If there is an overlap with any existing flower bed, output Yes; otherwise, output No.

inputFormat

The input is given through standard input (stdin) and has the following format:

  1. The first line contains an integer n, the number of existing flower beds.
  2. The next n lines each contain two integers a and b (with a < b), representing an existing flower bed.
  3. The last line contains two integers representing the new flower bed: anew and bnew.

outputFormat

Output a single line to standard output (stdout): Yes if the new flower bed overlaps with any existing flower bed, otherwise No.

## sample
2
2 4
10 14
5 9
No

</p>