beecrowd | 1873

Rock-paper-scissors-lizard-Spock

By Ricardo Martins, IFSULDEMINAS BR Brazil

Timelimit: 1

Rock-paper -scissors - lizard - Spock is an expansion of the classical method of selection for playing rock-paper- scissors. It operates under the same basic principle , but includes two other additional weapons : the lizard (formed by the hand like a puppet 's mouth ) and Spock ( formed by greeting the Vulcans in Star Trek ) . This reduces the chances of a round end in a draw . The game was invented by Sam Kass and Karen Bryla like " Rock Paper Scissors Lizard Spock ." In this version, the possible outcomes are:

• Scissors cuts paper

• Paper covers rock

• Rock tips lizard

• Lizard Spock falls asleep

• Spock melts scissors

• Scissors holds lizard

• lizard eats paper

• Paper disproves spock

• Spock vaporizes rock

• Rock crushes scissors

In Portuguese, this game is called "Pedra-papel-tesoura-lagarto-Spock", and the weapons are "pedra" (rock), "papel" (paper), "tesoura" (scissors), "lagarto" (lizard) and "Spock" (Spock).

One day , two friends Rajesh and Sheldon, decided to bet who would pay a lunch for the other, with this joke. Its mission will be to make an algorithm that , based on what they choose , tell who will win or will tie.

Input

There are many test cases. The first number is an integer C, the number of test cases. Each test case contains two words in Portuguese, the weapons chosen by Rajesh and Sheldon, respectively.

Output

For each test case, print who won, or "empate" if there was a tie.

Input Sample Output Sample

3

spock spock

tesoura spock

lagarto spock

empate

sheldon

rajesh