cho.sh
Notes
Loading...

Rectangle Overlap Type

Time limit

1s

Memory limit

128 MB

Problem

There are two axis-aligned rectangles on a two-dimensional coordinate plane. Each rectangle is given by four integers x y p q, where (x, y) is the lower-left corner and (p, q) is the upper-right corner. It is always true that x < p and y < q.

Determine the shape of the common part of the two rectangles and print the corresponding code letter.

Common partOutput code
Rectangle with positive areaa
Line segmentb
Pointc
No common partd

Input

The input consists of 4 lines. Each line contains 8 integers separated by spaces.

In each line, the first four integers are x y p q for the first rectangle, and the last four integers are x y p q for the second rectangle. Every coordinate value is an integer from 1 to 50,000.

Output

For each input line, classify the common part of the two rectangles. Print the corresponding code letter on its own line, in input order, for a total of 4 lines.