There are $n$ water troughs in a 2D plane. The $i$-th trough is a line segment connecting $(x_{i1}, y_{i1})$ and $(x_{i2}, y_{i2})$. All troughs are inclined ($y_{i1} \ne y_{i2}$). A marble falls vertically from $(x, 10^6)$. When it hits a trough, it rolls to the lower end, then falls vertically again, until it hits $y=0$.
**Task**: Given $q$ queries, each providing a starting $x$ coordinate. Find the final $x$ coordinate where the marble hits the ground ($y=0$).
#### Input
- First line: $n$ ($1 \le n \le 10^5$).
- Next $n$ lines: $x_1, y_1, x_2, y_2$.
- Next line: $q$ ($1 \le q \le 10^5$).
- Next line: $q$ integers representing starting $x$.
#### Output
- Print $q$ integers separated by space.
#### Example
Input:
```
4
1 3 4 2
3 4 5 5
8 1 11 2
7 5 10 3
3
5 6 8
```
Output:
```
4 6 8
```
#### Subtasks
- **Subtask 1 (50 points)**: $n, q \le 1000$.
- **Subtask 2 (50 points)**: No additional constraints.