Chasing After Don Giovanni

In Act II, Masetto is leading a group of villagers to chase after Don Giovanni. Giovanni, who has just exchanged his clothes with Leporello and is disguising as him, is asked by Masetto about where “his master” has gone. To avoid trouble, “Leporello” (disguised by Giovanni) wants to mislead the villagers so that they cannot find “Don Giovanni” (disguised by Leporello). Giovanni knows the route that Leporello is taking, and he has a safe route (a route that the villagers would not meet Leporello) in mind. He wants to make sure that the route he has is safe indeed. Input The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This line is followed by a blank line, and there is also a blank line between two consecutive inputs. You are given the current location of Don Giovanni (which is also the location of Masetto and the villagers), and the current location of Leporello, in two separate lines. Each line has two numbers: the Street number and the Avenue number. You can assume that the roads are regular square grids, with rows as streets numbered from one starting from the northmost, and columns as avenues numbered from one starting from the westmost. Therefore the distance between adjacent streets and avenues is always the same. The rest of the input has two sets of routes, with the first set being Leporello’s and the second being the route that Giovanni is going to tell the others. Each set starts with a number indicating the number of stops in the route, followed by the list of stops. Each stop is specified as a location, where Leporello may change direction. Between stops there is always a straight line in the direction of parallel to either streets or avenues, which Leporello and the villagers are going to travel. Leporello travels in the same speed as the villagers. You may assume the maximum street/avenue number is 1000000, and there are at most 100 stops. Output For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line. The output consists of a line saying ‘Yes’ or ‘No’, indicating whether the route that Giovanni is telling the villagers is a safe route. Remember that a route is not safe only if the villagers can meet Leporello in the same place at the same time; a route is safe even if the villagers meet Leporello at the destination (because his mission is accomplished). Sample Input 2 23 52 3 54 34 36 4

2/2 43 45 55 56 22 42 3 62 63 33 3 24 54 56 Sample Output No Yes