407007: GYM102680 B Apple Pen

Memory Limit:1024 MB Time Limit:5 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Apple Pentime limit per test5 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard output

After visiting the Apple store and playing with the new iPad Pro, many are hopelessly attracted to having their own Apple Pencil. However, because Apple Pencils have been brutally trademarked and are obscenely expensive, such visitors must settle for a compromise: making an Apple-Pen! Apple-Pens can be created by uh-ing a Pen with an Apple (uh-ing an Apple with a Pen would create a Pen-Apple, which, of course, is not nearly as cool). It has recently been discovered that this uh function can be applied to things other than apples and pens! Uhing item A with item B will create a new item: B-A. Given 2*n items, what will result when each pair of items are uhed?

Input

The first line will contain a single integer n, the number of times to perform the uh operation.

2*n lines follow. Each line will contain a sentence of the form "I have a <item>" where <item> is replaced by a single word of upper case letters, lower case letters, and hyphens (-), but not spaces.

$$$1 \leq n \leq 1000$$$

$$$1 \leq charactersPerItemName \leq 1000$$$

Output

Output n lines each of the form "Uh! <item b>-<item a>!" where "<item b>" and "<item a>" are replaced by their respective items.

ExampleInput
2
I have a Apple
I have a Pen
I have a Apple-Pen
I have a Pen-Pineapple
Output
Uh! Pen-Apple!
Uh! Pen-Pineapple-Apple-Pen!
Note

There are two test cases. In the first, an Apple is uhed with a Pen to create an Pen-Apple.

加入题单

算法标签: