Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 16M

Authors:
Problem type
PEG Test – Oct 3rd, 2014

Earthbending is an art which allows its users to manipulate earth and rocks in all of their various forms. Earthbenders are strong, persistent, and enduring people. The secret to being a good earthbender is waiting and listening for the right moment to strike decisively.

Aang, Katara, and Sokka are currently scouring the entire earth kingdom in search of a proper earthbending teacher for Aang. In the town of Gaoling, they have stumbled upon the Blind Bandit (i.e. a young, blind girl named Toph from a rich earth-kingdom family) in an earthbending tournament with The Boulder. Aang immediately knew that Toph was the one after she effortlessly defeated the boulder, but incidently defeated Toph with his airbending to claim the prize money himself after failing to convince her. Bitter about losing the prize money, the Boulder gathered the other earthbenders of the tournament and kidnapped Aang. Toph decides to rescue Aang and confronts The Boulder. Now, she must face the wrath of a giant earthbending wrestler who is closing in on her.

No sweat! It's the perfect time for Toph to test out her new technique – the Earth Cage. Toph creates an earth cage by erecting 4 rocky walls on the 2D-plane such that they form a rectangle whose sides are parallel to the X and Y axes. However, because Toph is blind, she cannot be instantly sure if her earth cage has trapped her opponent.

Given The Boulder's position and the locations of the four walls of the earth cage, determine if Toph has successfully trapped him. The Boulder will always be directly inside or outside of the walls.

Input Specification

The first line contains two integers x and y, representing the coordinates of The Boulder at the moment Toph raises the walls.
The second line contains four integers x_1, y_1, x_2, and y_2 (1
\le x_1 < x_2 \le 10^{7}; 1 \le y_1 < y_2 \le 10^{7}), the locations of the walls.
x_1 and x_2 are the x-coordinates of the vertical walls while y_1 and y_2 are the y-coordinates of the horizontal walls.

Output Specification

Output Yes if The Boulder is trapped, or No otherwise.

Sample Input

4 6
3 5 5 7

Sample Output

Yes

Comments

There are no comments at the moment.