478. Excursion
Time limit per test: 0.25
second(s)
Memory limit: 65536
kilobytes
input: standard
output: standard
One day a group of students, consisting of boys (
a heads) and girls (
b heads), got to an idea to make an excursion led by their school teacher over the city, they lived in. At the very start of the party schoolboys went away walking separately from the teacher, rather than obedient school girls, who stayed with the teacher. Anyhow, when approaching any boutique during the excursion, some girls can leave the group to go for a fitting their lovely dresses, and they will never come back again. On the contrary, ruddy cheeked and cheered up boys can go back to the teacher and stay with him with great enjoy until the end of excursion. At some points of time scrupulous teacher recalculates the number of students in the group and writes it down in his notebook.
Now the teacher wants to evaluate the effectiveness of extracurricular work, so he askes you to find any feasible student joining/disjoining schedule.
Input
The first line of input contains two integers
a and
b (1 ≤
a,
b ≤ 100) — the number of boys and girls respectively. The second line has the only integer
n (1 ≤
n ≤ 100) — the number of notes in teacher's book. The third one contains exactly
n nonnegative integers not exceeding 200, denoting numbers the teacher wrote down, in the order of their appearance in the notebook.
Output
If there are any mistakes in teacher's notes, that is no feasible schedule exists, print "
ERROR
". Otherwise, print to output
n lines.
ith line should contain two nonnegative integers, denoting the number of schoolboys joined and the number of schoolgirls separated from the teacher respectively exactly before he recalculated students at
ith time. If there are multiple solutions, output any.
Example(s)
sample input

sample output

3 3
2
2 3

1 2
2 1

sample input

sample output

3 3
3
1 2 5

ERROR

sample input

sample output

2 2
1
2

0 0
