Problem Description

You will receive n assignments like x = y + 5 or x = 10. Variables are single lowercase letters. Compute final values for all variables that appear on left side, assuming missing variables start at 0. Output values for a..z that were assigned at least once.

Input Format

First line n. Next n lines assignments.

Output Format

Multiple lines: var value.

Sample Test Case

Input:
4 x = 10 y = x + 5 x = y + 1 z = a + 2
Output:
x 16 y 15 z 2

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next