The Everbinding War finally ended after the Battle of Wellacotia. The Collean Government, realizing the futility of continuing the war, shortly surrendered afterwards. As such, the agreement signed to end the conflict is to be known as the Wellacotia Treaty. The Wellacotia Treaty consists of
The Quatryian government believes that Wellacotia has altered the terms on their copy of the treaty. They know the order of the original terms on the treaty, as well as the changes made by each diplomat. Help them determine the final order of the terms of the Wellacotia Treaty. Since this might be a little too difficult, they instead ask you to determine the country that each term of the treaty applies to.
Constraints
In all subtasks,
Subtask 1 [5%]
Subtask 2 [20%]
Subtask 3 [25%]
Subtask 4 [50%]
No additional constraints.
Input Specification
The first line contains three integers,
The second line contains
For each of the
Output Specification
Output one line consisting of
Sample Input
5 2 3
1 2 3 1 3
1 3
1 3 2
2 4
2 3 1
Sample Output
1 2 3 1 3
Comments