Common Area

Given two simple polygons, your task is to determine whether they have a non-empty common area. Note that the two rectangles in figure (a) share a segment, but no common area at all. By “simple polygon”, we mean the polygons will not be self-intersecting or self-touching, and will not have duplicated vertices or adjacent collinear segments. Note: be sure to test your program with many special cases. Input There will be at most 100 test cases. Each test case contains two lines, one for each polygon. Each polygon begins with an integer n (3 ≤ n ≤ 100), the number of vertices, then n pairs of integers (x, y) (−1000 ≤ x, y ≤ 1000), the vertices of the polygon, in counter-clockwise order. Output For each test case, print the case number and one of ‘Yes’ or ‘No’. Sample Input 400202202 420404222 400202202 410303212 Sample Output Case 1: No Case 2: Yes