MINIEYE's engineer M has designed a game recently.
There are two races A and B in the game and both of them can only appear on the integral points in the two-dimensional space. Characters of the same race have same eyesight, the eyesight for race A is Sa, for race B is Sb. If the Manhattan distance from character 1 to character 2 is within character 1's eyesight, then character 1 can see character 2.
The method to calculate the Manhattan distance between the two characters is: if the coordinate of character 1 is (x1,y1) and character 2 is (x2,y2), then the Manhattan distance between them is:|x2 - x1 | + |y2 - y1|.
If character 1 can see character 2, it means character 1 knows where character 2 is. Besides, a character can share with other characters of the same race about where the characters of the other race are if they can see each other.
To find a balance in the game, M hopes that:
1.Any characters from race A can know the position of any characters from race B.
2.There's a character from race B who doesn't know the position of a character from race A.
3. Sb > Sa.
M needs your help to analyze whether there are non-negative integers Sa and Sb that can meet the above balance requirements?
The first row of the input are two integers n and m(1 ≤ n, m ≤ 1000) separated by space, n and m respectively represents the character numbers of the two races.
For the following n rows, each row has two integers x and y separated by space to represent the coordinate of a character from race A.
And for another m rows, x and y represent the coordinate of a character from race B.
It’s guaranteed that -1000 ≤ x, y ≤ 1000.
Output one row which includes an integer. If suitable Sa and Sb are found, then output 1, otherwise output 0.
In the example Sa and Sb can be 4, 5.