The input consists of multiple test cases.
The first line contains an integer $T$ ($1 \leq T \leq 200$) -- the number of test cases.
For each test case:
In the first line, there are three integers $x,y,d$ ($|x|,|y| \leq 10^4$, $0 \leq d \leq 3$). The snake starts on $(x,y)$. $d$ shows the direction of the head of the snake. (0 for y+, 1 for x+, 2 for y-, 3 for x-)
In the second line, there is an integer $n$ ($1 \leq n \leq 10^5$), which is the number of foods.
In the next $n$ lines, each contains two integers $x,y$ ($|x|,|y| \leq 10^4$), which means the next food appears at $(x,y)$.
It is guaranteed that any line that connects two foods that appear adjacently does not parallel to the x-axis or the y-axis.