Niebieskie ksi.eczki
I Olympiad in Informatics 1993/1994

Task: TKT
Author: Piotr Chrz±stowski-Wachtel
Triangles

I stage contest  

A finite, at least three-element set A of rational length line segments is given. We want to examine whether from every three segments of A a triangle may be built.

An input data file is an at least three-element sequence of lengths of all line segments from the set A put in some order. Every segment length (a rational number) is written in a form numerator/denominator, where numerator and denominator are positive integers not greater than 9999.

Consecutive lengths in this sequence are separated by a space or a single end-of-line character.

There should be given an answer:
TAK ("yes"), if from every three line segments of A a triangle may be built.
NIE ("no"), if from not every three line segments of A a triangle may be built.
NONSENS ("nonsense"), if the data file is not correct, i.e. does not meet the above conditions.

Examples

For the input file:

13/10 1/2 6/5 11/6 9/7 3/5 9/7 13/10 9/5 8/5
the answer is NIE, because, for example, one cannot build a triangle from line segments of lengths: 6/5 3/5 9/5.

For the input file:

1/2 3/5 2/3 4/7 1/1 4/6
the answer is TAK.

For the input file:

1/2 3/5 2/3 4/7 1 4/6
the answer is NONSENS, because 1 is not a pair of numbers separated by a character /.

Task

Write a program, that successively for every data set from a file TKT.IN generates a correct answer TAK, NIE or NONSENS, and writes it to a file TKT.OUT.

The source text of the program should be written in a file named TKT.???, where ??? are substituted by a sequence of letters appropriate for the programming language used.

The executable program should be named TKT.EXE.