URI Online Judge | 1899

# Hit the Target!

By Ricardo Oliveira, UFPR Brazil

Timelimit: 1

"Hit the Target!" is a very popular game in Nlogonia. The rules of the game are very simple. A ball is standing on the ground. Also, there is a wall DT meters away from the ball, in which there is a target. The target begins AT meters from the ground, and ends BT meters from the ground (hence, its length is equal to BT-AT meters).

You must shoot the ball to some direction. The ball will then follow a straight line on the direction it was shot. The objective of the game is to shoot the ball to such direction that it hits any point of the target.

However, there are also N walls between the ball and the target. The wall i (1 ≤ i ≤ N) is Di meters away from the ball. There is only one opening in each wall. The wall i has an opening beginning Ai meters from the ground and ending Bi meters from the ground.

Of course, the ball must pass through all openings and hit the target. In the case the ball passes exactly at a point an opening starts or ends (i.e., Ai or Bi meters high), consider that the ball successfully pass through the opening.

Depending on the positions of the walls and the openings, it may not be possible to hit the target at all. Your task is to determine whether it is possible to hit the target or not.

The following image shows the first sample input and a possible route for the ball, which proves that it is possible to hit the target in that case.

## Input

The first line contains the integer N (0 ≤ N ≤ 1000). The next N lines contains three integers each, describing the walls. Line i (1 ≤ i ≤ N) contains the integers Di, Ai and Bi (1 ≤ Di ≤ 104, 1 ≤ Ai < Bi ≤ 104). The last line contains the integers DT, AT and BT (1 ≤ DT ≤ 104, 1 ≤ AT < BT ≤ 104). You may assume that D1 < D2 < ... < DN < DT.

## Output

Print a single line containing Y if it is possible to hit the target, or N otherwise.

 Input Samples Output Samples 3 50 5 30 100 15 30 150 30 60 200 30 60 Y
 2 20 20 40 40 10 30 60 10 50 N