You are given a circular maze such as the ones shown in the figures.
Determine if it can be solved, i.e., if there is a path which goes from the center to the outside of the maze which does not touch any wall. The maze is described by
\(n\) walls. Each wall can be either circular or straight.
- Circular walls are described by a radius \(r\), the distance from the center, and two angles \(\theta_1, \theta_2\) describing the beginning and the end of the wall in the clockwise direction. Notice that swapping the two angles changes the wall.
- Straight walls are described by an angle \(\theta\), the direction of the wall, and two radii \(r_1 < r_2\) describing the beginning and the end of the wall.
Angles are measured in degrees; the angle \(0\) corresponds to the upward pointing direction; and angles increase clockwise (hence the east direction corresponds to the angle \(90\)).
Output
For each test case, print YES if the maze can be solved and NO otherwise.
Note
The two sample test cases correspond to the two mazes in the picture.
Примеры
| № | Входные данные | Выходные данные |
|
1
|
2 5 C 1 180 90 C 5 250 230 C 10 150 140 C 20 185 180 S 1 20 180 6 C 1 180 90 C 5 250 230 C 10 150 140 C 20 185 180 S 1 20 180 S 5 10 0
|
YES
NO
|