A known Polish proverb is: `The apple always falls near the apple tree'1. Your task is to check this proverb experimentally. Positions of apple trees and apples can be identified with points on a plane. The distances between points are defined by Manhattan metric:

Let us assume that every apple has fallen from the apple tree closest to it.
Write a program that:
The first line of input contains two integers
and
(
), separated with a single space and denoting
the number of apple trees and the number of apples.
The second line of input contains
integers from the range
, separated with single spaces and denoting the pairs of
coordinates of apple trees:
.
The third line of input contains
integers from the range
, separated with single spaces and denoting the pairs of
coordinates of apples:
.
We treat both apple trees and apples as points on a plane;
there can be multiple apple trees and multiple apples in one point.
The first and only line of output should contain the smallest distance between an apple and its apple tree.
For the input data:
3 4 0 2 2 0 2 2 1 1 2 1 2 3 1 4
the correct result is:
1
Task author: Jakub Radoszewski.
W razie problemów technicznych ze Szkopułem, prosimy o kontakt mailowy pod adresem szkopul@fri.edu.pl.
Jeśli chciałbyś porozmawiać o zadaniach, rozwiązaniach lub problemach technicznych, odwiedź nasze serwery na Discordzie. Są one moderowane przez społeczność, ale członkowie zespołu wsparcia również aktywnie się tam udzielają.