Time Limit: 2 second(s) | Memory Limit: 32 MB |
All of you 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 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 i^{th} pair x_{i} y_{i} denote the co-ordinate of the i^{th} vertex of the room. The vertices will be given in anticlockwise 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.
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 Input |
Output for Sample Input |
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 |
Developed and Maintained by
JANE ALAM JAN |
Copyright © 2012
LightOJ, Jane Alam Jan |