#K76782. Library Fines

    ID: 34719 Type: Default 1000ms 256MiB

Library Fines

Library Fines

In the Library Fines problem, you are given a list of book loans. Each loan record consists of three integers: a book ID (which is irrelevant for the purpose of determining fines), the allowed loan period D (in days), and the actual number of days R taken to return the book. The task is to determine whether all books were returned on time. If any book is returned late (i.e. if R > D for any record), the output should be FINE; otherwise, the output should be ALL RETURNED.

The input begins with an integer N representing the number of books. This is followed by N lines, each containing three integers separated by spaces. Your solution should read from standard input and write the result to standard output.

In mathematical notation, for each loan record with values D and R, the condition for a fine is given by:

[ R > D ]

If the above inequality holds for any record, the overall output is FINE; if not, output ALL RETURNED.

inputFormat

The first line of input contains an integer N (1 ≤ N ≤ 10^5), representing the number of loans. Each of the following N lines contains three space-separated integers: the first integer is the book ID, the second integer D is the allowed loan period, and the third integer R is the number of days taken to return the book.

outputFormat

Output a single line containing the string ALL RETURNED if no book is overdue (i.e. R ≤ D for all books), or FINE if at least one book is returned late (i.e. R > D for any book).## sample

2
201 20 15
202 10 10
ALL RETURNED