Planely Speaking

Background

Many problems in computer graphics come down to being able to project three dimensional (think real world) images onto a two-dimensional (think this monitor) surface. For this reason, it is valuable to be able to determine if a set of points in threespace are in the same plane. It is well known that three points determine a plane, so the issue of points falling on the same plane only arises when you have more than three points.

The Problem

Your program should decide whether four given points in threespace all fall on the same plane. If they do, we will say these points are plainer, and if not we will say these points are nonplainar.

Input Specification

The file POINTS.DAT will consist of lines of data. Each line will contain 12 integers, which should be interpreted as the x y and z coordinates of a point in space. For example the input line:
1 2 3 4 5 6 7 8 9 10 11 12
indicates that the problem is addressing the four points (1,2,3), (4,5,6), (7,8,9), and (10,11,12). The last line will contain 12 zeros.

Output Specification

The output file POINTS.OUT will consist one word per input line, the word PLANAR if all of the points are co-planar, and NONPLANAR if the points are not.

Sample Input

1 2 3 2 3 4 -1 -2 -3 -2 -3 -4
1 2 3 4 5 9 -100 99 -1 50 50 100
1 1 2 8 1 9 -9 5 4 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 

Sample Output

PLANAR
PLANAR
NONPLANAR

I don't know what contest this problem is from. The sheet is not labeled.