If you have read all the problems up to this point, you should be able to tackle this one.
It includes expressions (again?!). These are simple assignment expressions of the form variable_1=function(variable_2, variable_3...) where the function in other variables (2,3,...) is an arithmetic expression including those variables and two operations - addition and multiplication. Multiplication has precedence over addition (as usual) and there are no parentheses.
Your task is to, given an expression in the input, output an equivalent expression that is no longer than the original one.
First line of the input contains an integer N (1 ≤ N ≤ 100), the number of expressions.
Then follow N expression on separate lines, all of them of the form described above (length of each expression will be at least 3 and no more than 100 characters).
Variables will be denoted by single capital letters of English alphabet. There will be a single assignment operator and the expression on the right hand side will be well-formed arithmetic expression consisting of numbers and several addition and multiplication operators.
The variable on the left hand side will not be repeated on the right hand side (no recursion! <phew>)
For each expression, output an equivalent assignment expression that will assign the same value to the variable_1. You can insert parentheses as needed (see example), just make sure that the expression you output is no longer than the original expression. If there are several expressions that satisfy these conditions, output any one of them.