This page is still under construction.

Parts of this page are still being built. What you see may change.

Exam

Time limit2sMemory limit256 MB

Summary
Given the exam start and end times and the minutes Igor needs, decide whether he finishes on time, up to an hour late, or fails.
Level

Easy2 of 10

Topics
Implementation, Math
Solved
No attempts yet

Problem

Igor is a good programmer but a big slacker. Having spent the whole semester playing computer games and watching a lot of TV series and movies, he suddenly realized that the exam session has arrived, and he has to pass it to avoid being expelled from the university.

Igor's first exam is in extreme programming. The exam works as follows: at some time S the problem statement appears, and Igor has to solve it by time F. The exam lasts at least one second and at most one day. If Igor solves the problem within the allotted time, he passes the exam. If he does not manage to solve it within an hour after the exam ends, he fails the exam. Otherwise, besides solving the problem, he has to write testing.

Igor knows how many minutes it will take him to write the program, and now he wants to know whether he can pass the exam, or whether he will have to write testing, or whether he will fail the exam altogether.

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 10⁴), the number of tests. The next n lines contain S and F in the format hh:mm:ss, and an integer k (1 ≤ k ≤ 2000), the start and end times of the exam and the time in minutes it takes Igor to write the program.

It is guaranteed that the times in the tests are given correctly.

Output

For each test, output the answer on a separate line. If Igor passes the exam, output Perfect. If Igor has to write testing, output Test. Otherwise, output Fail.

Examples1

  1. Example 1

    Input
    4
    01:02:03 01:05:03 3
    23:12:14 00:14:59 91
    00:00:00 00:00:00 1000
    01:00:00 05:00:00 666
    
    Expected output
    Perfect
    Test
    Perfect
    Fail