Problem Description

You have two variables a and b. For each step you get newA and newB expressions in terms of old a and b: 'A' means old a, 'B' means old b, or an integer. Apply parallel assignment each step (both update together). Output final a b.

Input Format

Line1: a b. Line2: m. Next m lines: exprA exprB.

Output Format

One line: a b.

Sample Test Case

Input:
1 2 3 B A A 5 B A
Output:
5 2

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next