beecrowd | 2492

By João Marcos Salvanini Bellini de Moraes, IFSULDEMINAS Brazil

Timelimit: 1

Friederich Estrotoratch, a famous mathematician and philosopher, recently bought several islands in the Pacific. Since he loves inverse functions with devout passion, he wants to connect these islands so that they resemble an inverse function. Estrotoratch hates to waste time on work he deems unnecessary, and therefore passed to Johann Fritz, his subordinate, the task of determining how exactly the connections bewteen the acquired islands would be. But Fritz isn't very mentally balanced (as well as his superior) and he's doing this work in one of his crisis.

Knowing his own not good at all situation, Fritz decided he would give you the connections for you to tell him whether they are correct. He wants you to say if the connections even form a function, and if they do, whether the function is invertible. So help the poor guy, because otherwise the consequences for him (that is, the punishments) are unpredictable.

## Input

The input consists of several test cases. Each test case contains an integer T (2 ≤ T ≤ 100), indicating the number of connections, always like "X -> Y", indicating that there's a way connecting the island X to the island Y. This connection isn't mutual, that is, it doesn't mean there's a way connecting Y to X. The name of the islands will have up to 30 characters with no blank spaces. Read input until T = 0.

## Output

For each test case, print "Not a function." if it's not a function, "Invertible." if the function is invertible and "Not invertible." if the function is not invertible.

 Input Sample Output Sample 4 Rosamund -> Montonho Chuiran -> Kirsten Castro -> Martins Brandenburg -> Honig 2 Latartuga -> Fritz Estro -> Fritz 3 1478 -> Vogel Strauss -> 1478 1478 -> Strauss 3 Kaninchen -> Gebirge Wahnsinn -> Traurigkeit Schreien -> Gebirge 0 Invertible. Not invertible. Not a function. Not invertible.