|Contests||Virtual Contests||Problems||Submit||Runs Status||Rank List||Forum|
Goodhorse's little niece Wenwen is very clever, but she is not very happy, because her mother always leaves her many difficult homework to do. Every time when goodhorse comes to see wenwen, she always takes out many homework, and let goodhorse to solve. One of the homework is : Given Wenwen is a variable, equals to sum of some variables and some constant numbers. Each variable is also equal to sum of some variables and some numbers. Wenwen need to work out what herself equals to.
All the equations are in following forms:
Because wenwen's mother has promised that, if she can work out this problem, she will be able to go to play in Guihu Park with her uncle. Otherwise, she will not be allowed to play even watching TV. So goodhorse is very keen to help her.
The first line contains an integer n (n ≤ 10), denotes the total number of equations. Each of the following n lines is one valid equation. Every variable will appear in and only in one equation's beginning. Each equation's length will not exceed 100. Each variable's value will be positive and not exceed 10000. Each equation will only contain "=","+", variables and numbers, and will not contain blank/space character. Each variable will only contain lowercase characters and each number is 10-based, contains only digit characters.
If one variable's value needs its own value at last, i.e. there exists an assignment loop, output "poor wenwen:(". Otherwise output wenwen's value in form of "wenwen=A", which A is the value.
Sample Input 1
Sample Output 1
Sample Input 2
Sample Output 2
Please note that wenwen herself is also a variable.