#abc233h. [abc233_h]Manhattan Christmas Tree

[abc233_h]Manhattan Christmas Tree

Problem Statement

There are NN Christmas trees in the two-dimensional plane. The ii-th tree is at coordinates (xi,yi)(x_i,y_i).

Answer the following QQ queries.

Query ii: What is the distance between (ai,bi)(a_i,b_i) and the KiK_i-th nearest Christmas tree to that point, measured in Manhattan distance?

Constraints

  • 1leqNleq1051\\leq N \\leq 10^5
  • 0leqxileq1050\\leq x_i\\leq 10^5
  • 0leqyileq1050\\leq y_i\\leq 10^5
  • (xi,yi)neq(xj,yj)(x_i,y_i) \\neq (x_j,y_j) if ineqji\\neq j.
  • 1leqQleq1051\\leq Q \\leq 10^5
  • 0leqaileq1050\\leq a_i\\leq 10^5
  • 0leqbileq1050\\leq b_i\\leq 10^5
  • 1leqKileqN1\\leq K_i\\leq N
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN x1x_1 y1y_1 vdots\\vdots xNx_N yNy_N QQ a1a_1 b1b_1 K1K_1 vdots\\vdots aQa_Q bQb_Q KQK_Q

Output

Print QQ lines.
The ii-th line should contain the answer to Query ii.


Sample Input 1

4
3 3
4 6
7 4
2 5
6
3 5 1
3 5 2
3 5 3
3 5 4
100 200 3
300 200 1

Sample Output 1

1
2
2
5
293
489

The distances from (3,5)(3,5) to the 11-st, 22-nd, 33-rd, 44-th trees to that point are 22, 22, 55, 11, respectively.
Thus, the answers to the first four queries are 11, 22, 22, 55, respectively.