A king is angry at two scientists, so he decrees the following punishment. The scientists will be imprisoned in towers at opposite ends of the kingdom. Each morning, a guard at each tower will flip a coin and show the result to his prisoner. Each prisoner must then guess the result of the coin flip at the other tower. If at least one of the two guesses is correct, they will live another day. But as soon as both guesses are incorrect, they will be executed.

On the way out of the throne room, the scientists manage to confer briefly, and they come up with a plan that will spare them indefinitely. What strategy guarantees them to escape their execution forever?

de twee torens
Charles Martel looks after punishment and banishment of two men, from the Grandes Chroniques de France, 1375-1379.

There exists a rock-solid strategy that will lead to exactly one prisoner guessing correctly at all times. It's easiest to explain this strategy by observing that either both flips give the same or a different result. That is the paradigm shift you have to make to understand that the strategy simply is to decide which of the two prisoners will answer with the same result as the coin flip at his own tower and which prisoner will answer with the opposite result of the coin flip at his own tower. It might seem unlikely, but the following figure shows that this strategy guarantees that at least one guess will always be correct.

strategy
The rock-solid strategy will lead to exactly one prisoner guessing correctly at all times.

Input

The first two lines contain the outcomes of the coin flips at the towers of the first and second prisoner: head or tail. The third line indicates which scientist (first or second) will always say the same result as the one of the coin flip at his own tower. The other scientist will always answer with the opposite of the coin flip at his own tower.

Output

Two lines that respectively contain the answer (head or tail) of the first and the second prisoner, if they follow the infallible strategy described above.

Example

Input:

head
tail
second

Output:

tail
tail