scor
The informatics teacher has a special way of telling students how much they scored in tests. To some students she tells them the exact score they got (e.g.: "Ionel got 76 points"), while to other students she tells them how they scored reference the score of one of their colleagues (e.g.: "Gigel scored 5 points less than Vasilica").
The teacher is however careful so that every student, having analyzed provided information, can deduce how much they scored.

Task
Write a program that displays how much each student scored.

Input Data
Input file scor.in contains on the first line a positive integer n, which represents the number of statements the teacher made. Each of the following n lines contains a statement. Statements are written in the file in short form:
Student_name = Number_of_points (which means that the student with the specified name got the specified score)
or
Student_name_1 = Student_name_2 + Number_of_points (which means that student named Student_name_1 scored Number_of_points more than student named Student_name_2)
or
Student_name_1 = Student_name_2 - Number_of_points (which means that student named Student_name_1 scored Number_of_points less than student named Student_name_2)

Output Data
Output file scor.out will contain one line for each student. Each line will contain the student's name followed by the score he/she got, separated by a single space. Students will be displayed in the output file in alphabetical order.

Constraints

Examples

scor.in scor.out

6
ANA = DAN + 5
DAN = ION -7
MARIA = 3
ION=MARIA+25
VASILE = ION -1
ANA= ION-2

ANA 26
DAN 21
ION 28
MARIA 3
VASILE 27

Time limit: 0.1 seconds/test

prof. Emanuela Cerchez
Computer Science High School "Grigore Moisil" Iasi
Contact:emanuela.cerchez@gmail.com