Time limit
1s
Memory limit
128 MB
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 part | Output code |
|---|---|
| Rectangle with positive area | a |
| Line segment | b |
| Point | c |
| No common part | d |
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.
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.