Geometry of Rectangles

4.1

13 votes
Problem

SKITians are good with mensuration hence they like to play with geometric shapes like rectangles in the plane. You are given two rectangles as expected. The sides of each rectangle are parallel to the coordinate axes. Each rectangle is given by the coordinates of its lower left corner and its upper right corner.

You are given the (x,y) coordinates for both of the corners.

You are required to find out the following properties of the rectangles. There are four options:

If the rectangles have a non-zero area in common, then print "Rectangle" Otherwise, if they have a common line segment with non-zero length, print "Line" Otherwise, if they have a point in common, print "Point" Otherwise, print "Apart" (in all four cases, the quotes are just for clarity and the output is case sensitive).

Input

First line of input contains an integer T that denotes the number of test cases.

Each test case contains two lines of input where both lines have four space separated integers representing x1 y1 x2 y2. First line is for first rectangle and second line of input for second rectangle.

Output

Print appropriate response in a line for each test case.

Constraint

  • 1 <= T <= 200
  • 0 <= x1,y1,x2,y2 <= 1000
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Case #1:

As it is clear these two rectangles share a common line segment of length greater than zero.

Case #2:

In this case, both of rectangles only share a common point.

Case #3:

These two rectangles do not have anything common between then, hence they are "Apart" from each other.

Editor Image

?