All of you must know about "Alauddin vai". But what you don't know is, he sometimes walks while sleeping. Yes, some kind of sleep walking.
Now one day he was sleeping in a strange room. But after waking up he doubts that whether he is inside the room or not.
You may assume that the room can be modeled as a polygon whose coordinates are 2D integer points. Alauddin vai can be thought as a 2D integer point. Now you are given the configuration of the room and the position of Alauddin vai (after waking up). You have to decide whether he is still in the room or not. Consider him inside if he is on the boundary of the polygon.
Input
Input starts with an integer T (≤ 10), denoting the number of test cases.
Each case starts with an integer n (3 ≤ n ≤ 100) denoting the number of vertices of the room. The next line contains 2n integers, where the ith pair xi yi denote the co-ordinate of the ith vertex of the room. The vertices will be given in anti-clockwise order.
The next line contains an integer q (1 ≤ q ≤ 300) denoting the number of queries. Each of the next q lines contains two integers x y denoting the co-ordinate of Alauddin vai. The absolute value of the given co-ordinates will be less than 10001.
Output
For each case, print the case number in a single line. Then print q lines, containing the answer for the queries as given in input. Print Yes
if he is inside the room, print No
otherwise.
Sample
Sample Input | Sample Output |
---|---|
2 3 0 0 10 0 0 20 2 5 5 10 10 3 0 0 3 3 0 3 1 5 5 | Case 1: Yes No Case 2: No |