This page is still under construction.

Parts of this page are still being built. What you see may change.

Alien

Interview

Time limit2sMemory limit128 MB

Summary
Given a point and n axis-aligned rectangles, decide whether any rectangle contains the point, boundaries included.
Level

Easy1 of 10

Topics
Geometry, Implementation, Brute force, Array
Solved
No attempts yet

Problem

After winning yet another competition, Bakhytzhan, Askar, and Artem were walking through the Old Square. They stopped when they noticed some interesting rectangle-shaped lines drawn on the asphalt. People said these rectangles were the marks left by alien ships that had landed on the square the night before.

Each alien ship occupies an axis-aligned rectangular region on the Cartesian plane. Now they want to know whether any alien ship had landed exactly on the spot where Bakhytzhan stopped. A ship is considered to have landed on that spot if its rectangular region contains Bakhytzhan's coordinates (points on the boundary are included).

Input

The first line contains a single integer nn, the number of alien ships (1≤n≤10 0001 \le n \le 10\,000).

The second line contains two integers b1b_1 and b2b_2, Bakhytzhan's coordinates (−10 000≤b1,b2≤10 000-10\,000 \le b_1, b_2 \le 10\,000).

Each of the following nn lines describes one ship with two pairs of integer coordinates: the first pair lxl_x, lyl_y is the bottom-left corner of the ship (rectangle) and the second pair hxh_x, hyh_y is the top-right corner (−10 000≤lx,ly,hx,hy≤10 000-10\,000 \le l_x, l_y, h_x, h_y \le 10\,000).

Output

Print Yes if any alien ship had landed on the spot where Bakhytzhan stopped, and No otherwise.

Examples1

  1. Example 1

    Input
    2
    2 2
    1 1 4 4
    5 5 7 7
    
    Expected output
    Yes