Dog, traitor and cable
Now the traitor has a dog! The deck of a spaceship can be represented as a checkered field , the rows of which are numbered from to from top to bottom, and the columns from to from left to right. Between some adjacent cells on the side there are cable segments.
At the start of the game, the dog is located in the cell , i.e. the top left cell. It chooses one of the players, let the chosen player be in the cell . The dog chooses one of the shortest routes from its starting position to the cell (in one move the dog can move from the cell to the adjacent side). After that, the dog and the player take turns making moves. The dog runs along the route chosen at the very beginning, and the player runs towards it along the same route from the end. The dog makes the first move. This process continues until the dog and the player are in the same cell. Every time the dog crosses a piece of cable, it bites it.
Help the players determine the maximum number of pieces of cable that a dog can bite into.
Input
The first line contains three integers and — field dimensions and number of cable sections.
The following is a description of cable segments. Each segment is described by four integers and . These numbers define the positions of two adjacent cells and , on the border between which there is a cable segment. It is guaranteed that cells and are side-adjacent.
The next line contains one integer — the number of positions of the players for which you want to calculate the answer.
The next lines contain two integers and — the player's position.
Output
Print lines, the -th line contains one number — the maximum number of cable segments that a dog can bite in the -th case.
Examples
Below given the locations of the wires in the first and the second test cases.