iSharp

Time limit1sMemory limit128 MB

Problem

Sunyoung created a very elegant programming language, different from C, C++, and Java, and named it i#.

i# provides basic data types along with arrays ([]), references (&), and pointers (*). Arrays, references, and pointers can be freely mixed in any order. For example, a pointer to an array of a reference to a reference to int is a valid type, written as int&&[]*.

In i#, several variables can be declared together on one line. First write the common data type, then for each variable write its name followed by the additional type symbols that apply only to that variable. For example, in

int& a*[]&, b, c*;

the types of the variables are:

  • a has type int&&[]*
  • b has type int&
  • c has type int&*

The type symbols written to the right of a variable's name can be moved to the left of the name (right after the common type) by reversing their order symbol by symbol, where [] counts as a single symbol. Thus int*& a is the same as int a&*.

Because declaring many variables on one line is hard to read, from now on we want to declare one variable per line.

Given one i# variable declaration, write a program that moves every type symbol on the right of each variable to the left according to the rule, and declares one variable per line.

Input

The first line contains one i# variable declaration. This declaration may contain several variables.

The declaration is structured as follows:

  • It begins with the basic data type.
  • This is followed by the common type symbols (there may be none).
  • After a single space, the variable declarations follow. Each variable declaration is separated by a comma and a space (, ), and the whole declaration ends with ;.
  • Each variable declaration starts with the variable name, followed by the additional type symbols that apply only to that variable (there may be none).

The basic type name and the variable names are not equal to each other, and consist only of lowercase and uppercase letters. The only type symbols are &, *, and []. The length of the input line does not exceed 120 characters.

Output

Transform the given variable declaration according to the rules and print one variable per line. Each line prints the variable's completed type and its name, with a single space between the type and the name, and ends with ;. Print the variables in the order they were declared in the input.