P28555 [洛谷] yyy2015c01's IDE: Watches
普及+
题目描述

Background

On a day in 2020, our classmate yyy2015c01 wanted to develop an IDE.

Problem Description

As a member of his development team, you were unfortunately selected to join the Debugger development group.

yyy2015c01 envisioned the Debugger to consist of several parts, one of which is the Watches component—referred to in Chinese as the "Variable Watcher."

Since the IDE is currently in beta, the development team needs to first create a Watches that can observe the values of int type variables to see how it performs. This task has been assigned to you.

The team imagines the Watches to be capable of monitoring the values of variables after executing the following three types of statements:
- n=1; Assign a constant to a variable, ensuring the constant's digit count does not exceed 9.
- a=b; Assign a value between variables: if the original variable (in this case, b) has not been assigned a value, its initial value is considered to be 0.
- m=1+2; Assign the result of an expression A+B, where only the + operator is used and there are exactly two numbers or variables, with both A and B ranging from 1 to 10^6.

Please write a Watches that, after all statements have been executed, outputs the values of all assigned variables in lexicographical order of their identifiers (ensuring that no variable's value exceeds the maximum value of an int).

Input Format

The input consists of \( n+1 \) lines.

The first line is a positive integer \( n \), indicating the total number of assignment statements.

Lines 2 to \( n+1 \) each contain an assignment statement (in the format "variable=expression;"), ensuring no extraneous characters are present.

Output Format

The output consists of \( n \) lines: each line contains an assigned variable identifier and its value.

Sample Input and Output

Sample Input #1

3
a=233;
b=a;
c=a+b;

Sample Output #1

a 233
b 233
c 466

Sample Input #2

3
a=233;
b=1+1;
a=b;

Sample Output #2

a 2
b 2

Notes

The data is weak, so a direct simulation will suffice.

(Don't assume that variable identifiers are only one character long!)

Additionally, a tribute to the protagonist of this problem, yyy2015c01!

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 a=233; b=a; c=a+b;
样例输出
a 233 b 233 c 466