Problem Description

We have {x}. Make final score for each key as sum of scores from both lists (missing is 0). Output keys sorted with their final score.

Input Format

Line1: n. Next n lines: key score. Then line: m. Next m lines: key score.

Output Format

Lines: key totalScore.

Sample Test Case

Input:
2 a 5 b 2 3 b 3 c 10 a -2
Output:
a 3 b 5 c 10

Constraints

n+m

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next