SOLVE
LATER
Monk is working on X−Y coordinate plane having N line segments indexed from 1 to N, and each one is represented with its 2 endpoints \([(x1,y1),(x2,y2)]\). He asks you Q queries on this X-Y plane.Each query contains an integer K.You have to tell the smallest index of line segment having atleast K lattice points.
If no such line segment exists print "-1".
Note: Lattice points are those points which have both x and y co-ordinate as an integer. Endpoints are also considered as lattice points.
Constraints:
\(1 \le N \le 10^5\)
\(-10^{10} \le x_1,y_1,x_2,y_2 \le 10^{10}\)
\(1 \le Q \le 10^5\)
\(1 \le K \le 10^9\)
Format of the input file:
First line : N
Next N lines : Four space separated integer x1,y1,x2,y2.
Next line : Q
Next Q lines : Integer K.
Format of the output file:
Print the final result to each query in a separate line.
First line segment (with index=1) have 3 lattice points including the endpoints.
Hence the answer is 1.