Asilbek has joined the company. Asilbek's manager gave him a task. According to the task, there is a configuration file and it consists of 3 actions:
The value value can be of two types:
There are no extra spaces in the actions, and each action is listed on a separate line. Variable names consist of lowercase English letters and are no longer than 10 .
Initially, each variable has the value 0. The operation of assigning a value to a variable is valid until the end of the block. When the block ends, the variable returns its previous value. Asilbek's manager wants to know what level Asilbek has, so he gave him this task. Help him.
The first line is the number of actions, n(1≤n≤106).
The next n lines contain the actions.
Print the new value of each variable when performing type 3 operations on a separate line.
13 a=1 b=a { a=2 c=a { a=3 d=a } b=a } a=c d=a
1 1 2 2 3 3 2 0 0