Ray Chasing
시간 제한1초메모리 제한2048 MB
축에 나란한 상자 안의 한 점에서 다른 점 방향으로 나아가는 광선이 처음 만나는 변이나 꼭짓점을 구한다.
문제
Ray tracing is becoming very popular in modern video games. You decide to brush up on the topic. After reading a bit of the math behind how it works, you feel the need to get a bit of hands-on experience. So you consider the following simple problem that does not involve any reflections of the ray.
Given a box with sides parallel to the - and -axes of the Euclidean plane, you emit a ray starting from some point in the interior of the box. Calculate which side of the box is first hit by the ray. If the ray perfectly hits a corner, you should indicate both sides of the box that meet at that corner.

Figure 1: Illustration of the second test case. The ray starting at and passing through will pass through the top-left corner of the box.
입력
The first line of input consists of four integers , , , . These give the coordinates of the sides of the box. The second line contains four integers , , , describing two points , and (i.e. the points are distinct). This indicates the ray starts at point and travels in the direction that passes through . All integers in the input will lie between and (inclusive). Note, the point may lie inside the box, on the boundary of the box, or even outside the box; it merely indicates the direction the ray is travelling.
출력
If the ray does not hit a corner of the box, print the appropriate string left, right, bottom, or top indicating which side was hit by the ray. These correspond to the following ranges of coordinates.
- The
leftside is . - The
rightside is . - The
bottomside is . - The
topside is .
If the ray hits a corner of the box, output the corresponding hyphenated string indicating which corner was hit: top-left, top-right, bottom-left, or bottom-right.