Under construction

Still being built. Things may change

Two Boxes

Interview

Time limit2sMemory limit512 MB

Summary
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.

(a) POINT(b) LINE(c) FACE(d) FACE(e) NULL

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.

Examples4

  1. Example 1

    Input
    1 2 3 5
    3 5 8 11
    
    Expected output
    POINT
    
  2. Example 2

    Input
    3 5 9 10
    5 4 8 11
    
    Expected output
    FACE
    
  3. Example 3

    Input
    1 2 3 5
    9 3 12 7
    
    Expected output
    NULL
    
  4. Example 4

    Input
    3 5 9 10
    9 3 12 7
    
    Expected output
    LINE