The skyline of a city shows the horizon view of its buildings. In this problem we are dealing with rectilinear skylines such us the ones shown in the figure. Each skyline can be represented by a vector of points with the following properties: An empty skyline is represented by an empty vector. A non-empty skyline must have at least two points.
The next figure shows three skylines that are represented by the red points. The top-left skyline is represented by the vector of points:
The problem consists of generating the skyline obtained by the superposition of two skylines. In the figure, the skyline at the right is obtained by the superposition of the two skylines at the left.
The input will start with a number of test cases. Each test case will be made of two skylines. Each skyline will be represented by its number of points and its set of points (fullfilling the previous properties). All the values are integers.
The output will consist of lines, each one representing the skyline obtained after the superposition of two skylines of the corresponding test. Use the same format as the input.
Download the code.cc or code.py file: you only have to implement the skylinesuperposition() function. Do not modify the other functions.
Input
4 7 1 2 4 4 6 1 8 0 10 3 12 1 14 0 5 2 3 6 2 9 0 11 4 13 0 2 0 8 10 0 4 3 15 8 4 10 2 12 0 0 3 5 1 7 3 9 0 0 0
Output
9 1 2 2 3 4 4 6 2 9 0 10 3 11 4 13 1 14 0 5 0 8 3 15 8 8 10 2 12 0 3 5 1 7 3 9 0 0