only-beautiful-versions-of-brokenness-9
Source: hackerearth
Difficulty: EASY

Somnath is supposed to submit an assignment for his semester, but The Code Goddess cursed his keyboard. While typing the “HOME” and “END” keys gets pressed internally in a random manner.
Since Somnath is in a hurry and he couldn't rectify his assignment. Can you help him with recovering the original text?

Input Format
The first line consists of a single integer T.
Next T lines contains a single string S in each line containing any alphabets and underscores (no spaces) and two special symbols “<” indicating HOME button is pressed and “>” indicating END button is pressed.

Output Format
For each string S output a single line containing the rectified text.

Constraints

1 ≤ T ≤ 10^5 
1 ≤ |S| ≤ 1000

SAMPLE INPUT
2  
_even_debug<Do_you>_bro  
_beautiful_versions_>of_<_perfection_only>brokenness<There_is_no

SAMPLE OUTPUT
Do_you_even_debug_bro  
There_is_no_perfection_only_beautiful_versions_of_brokenness