beecrowd | 2591

HameKameKa

By Ricardo Martins, IFSULDEMINAS BR Brazil

Timelimit: 1

The Hamekameka was invented by Master Hame practiced for fifty years before meeting Kogu. Calling his latent energy in the palms of his hands, Hame manages to launch an explosive bolt of energy. Kogu learns after seeing Master Hame using it to extinguish the flames in a King's house. To Hame's surprise, Kogu manages to perform the First-rate technique, though it is only strong enough to destroy the car that Chamya gave to Mulba. Kogu has discovered that there is a pattern in the correct pronunciation of this attack, so that if it is not pronounced correctly, it does not.

Write a program that, given the initial part of a Hamekameka, makes the ideal ending for the attack to be successful.

Input

The input begins with a value C, indicating the number of test cases. Next, we have C lines, each with the beginning of an attack, with a maximum of 200 letters.

Output

For each test case, print out the appropriate finalization so that the attack be successful.

Input Sample Output Sample

4
hamekame
haamekaame
haaamekaame
haaaamekaaame

ka
kaaaa
kaaaaaa
kaaaaaaaaaaaa