Yet Another Geometry Problem

아직 제출이 없습니다시간 제한4초메모리 제한256 MB

문제

There is a 22-dimensional plane described as (x,y)0xM,0yM\\{(x,y)|0 \leq x\leq M,0\leq y\leq M\\}. We also have another NN points P(x_i,y_i)P(x\_i,y\_i). Different points may share the same coordinates.

We define a good space as a square(in the given plane) with no point strictly inside it. Endpoints of the square should be on integers coordinates. 

In each query, given (u,v)(u,v), please calculate the largest area of a good space which (u,v)(u,v) is strictly inside.

Notice that the border of a legal space has to be parallel to x-axis or y-axis and it should not cross the border of the plane.

입력

There are multiple test cases. The first line of the input contains an integer TT(T10T \leq 10), indicating the number of test cases. For each test case:

The first line contains two integers MM(2M109{2\leq M\leq 10^9}) and NN(0N5000{0\leq N\leq 5000}).

In the following NN lines, each line contains two integers X_i,Y_iX\_i,Y\_i(0X_i,Y_iM{0\le X\_i,Y\_i\le M}),which denotes the Euclidean coordinate of P(x_i,y_i)P(x\_i,y\_i).

Then the next line contains one integer QQ(1Q5000{1\leq Q\leq 5000}), which denotes the number of queries.

In the following QQ lines, each line contains two integers u,vu,v(0u,vM){0\le u,v\le M}).

출력

For each query, please output an integer as the answer in one line.

Specially, if there is no legal good space, please output 00 instead.