Hide

Problem F
Cake

Winnie the Pooh, Rabbit, and Piglet came to visit Christopher Robin on his birthday. The main gift is a huge round honey cake with four candles. However, to eat the cake, it needs to be cut into four pieces first. Knowing how much Winnie the Pooh loves honey, one could expect that he would immediately take the biggest piece of cake and surely get stuck in the door, just like when he and Piglet visited Rabbit.

\includegraphics{cake.png}

To avoid this, Christopher Robin decided to cut the cake into four equal parts, and to emphasize the festivity, since this is not an ordinary cake but a celebratory one, and to simplify the cutting, the cake should be cut with two perpendicular cuts passing through its center, with exactly one candle on each of the resulting pieces. At the same time, to ensure that no one ends up with a broken candle and feels offended, Christopher Robin wants to make sure that the cuts do not pass through any of the candles.

Input

The input contains the description of the cake. The center of the cake is taken as the origin of the coordinate system. The first line contains a single integer $R$ $(1 \le R \le 10^9)$ — the radius of the cake. The following four lines contain the coordinates of the candles $x_i, y_i$. It is guaranteed that all candles are strictly within the cake.

Output

The sole line of the output should contain “YES” if Christopher Robin can cut the cake as he wishes, and “NO”, otherwise.

Sample Input 1 Sample Output 1
10
0 1
1 0
0 -1
-1 0
YES

Please log in to submit a solution to this problem

Log in