Help the bird Faby to navigate through a sequence of $$$n$$$ pairs of pipes, by finding the shortest line he can fly on to reach his destination. For simplicity, we represent Faby as a single point in the plane and assume every pipe has width zero. This way, the gap between every pair of pipes can be represented as an interval on the $$$y$$$ axis. The bird starts out at $$$s = (x_s, y_s)$$$ and his goal is to reach $$$t = (x_t, y_t)$$$. Find the shortest line from $$$s$$$ to $$$t$$$, passing through all intervals in between in increasing order of their $$$x$$$ coordinates.
Visualisation of the second sample input. The red lines represent the intervals and the black line the shortest possible path. Faby and the black dots are the points in the output. Note that $$$(2, 1)$$$ can optionally be included in the output too. The input consists of:
Output a sequence of $$$k$$$ $$$(2 \le k \le n+2$$$) points $$$p_1, \dots, p_k$$$, one per line, such that:
0 0 10 015 -10 10
0 0 10 0
0 0 10 042 1 34 2 37 0 29 -2 -1
0 0 4 2 9 -1 10 0