Two Boxes
InterviewTime limit2sMemory limit512 MB
Given two axis-aligned rectangles, classify how they intersect: overlapping interiors (FACE), sharing a segment (LINE), touching at one point (POINT), or disjoint (NULL).
- Level
Medium4 of 10
- Topics
- Geometry, Implementation, Math, Brute force
- Solved
- No attempts yet
Problem
Two boxes (rectangles) P and Q lie on a two-dimensional coordinate plane. The sides of each box are parallel to the x-axis or the y-axis. Hak-su, who studies boxes, wants to examine the intersection state of these two boxes and distinguish whether their interiors overlap (FACE), otherwise they meet along a line segment (LINE), otherwise they meet at a single point (POINT), or they do not meet at all (NULL).
The following figure shows examples of the various intersection states of two boxes.
In the FACE case, note that one box may be contained in the other, as in (d).
Given the information about two boxes, write a program that outputs the intersection state of the two boxes.
Input
The standard input gives the information for the two boxes, one box per line. The information for each box consists of the coordinates of the lower-left vertex (x1, y1) and the coordinates of the upper-right vertex (x2, y2), and these coordinate values x1, y1, x2, y2 (x1 < x2, y1 < y2) are given separated by spaces.
Output
The standard output prints the intersection state of the two boxes as one of POINT, LINE, FACE, NULL. The intersection state of the two boxes is printed in all uppercase letters.
Constraints
In every subtask, the x-coordinates and y-coordinates are all integers between -109 and 109 inclusive.




