Given two sets and of points on the plane, determine, for each point in , the minimum of the Manhattan distances to the points in .
Input consists of a natural , the coordinates of the points in , a natural , and the coordinates of the points in . Assume and . The coordinates are real numbers. Points can be repeated.
For every point in , print the Manhattan distance to its closest point in .
This problem tolerates an error of for each output.
Input
5
0 0
0 1
1 0
1 1
1 0
3
0.1 0.1
0.5 0.5
1.0 1.0
Output
0.20000000 1.00000000 0.00000000
Input
3
2057.54368732 7224.84142068
6754.64655994 7907.85575136
9678.10748947 4968.45548394
4
6628.69040481 8947.34821279
747.4327363 8300.22431512
8784.52986333 4373.37802232
7170.45535426 6464.09159581
Output
1165.44861656 2385.49384546 1488.65508776 1859.57294987
Input
5
0 0
0 1
1 0
1 1
1 0
3
0.1 0.1
0.5 0.5
1.0 1.0
Output
0.20000000 1.00000000 0.00000000