{"raw_statement":[{"iden":"statement","content":"A long time ago somewhere in the depths of America existed a powerful tribe governed by the great leader Pinnie-the-Wooh. Once the tribe conquered three Maya cities. Pinnie-the-Wooh grew concerned: there had to be some control over the conquered territories. That's why he appealed to the priests of the supreme god Mogohu-Rea for help.\n\nThe priests conveyed the god's will to him: to control these three cities he should put an idol to Mogohu-Rea — that will create a religious field over the cities. However, the idol is so powerful that it can easily drive the people around it mad unless it is balanced by exactly three sacrifice altars, placed one in each city. To balance the idol the altars should be placed so that the center of mass of the system of these three points coincided with the idol. When counting the center of mass consider that all the altars have the same mass.\n\nNow Pinnie-the-Wooh is thinking where to put the idol. He has a list of hills, that are suitable to put an idol there. Help him to identify on which of them you can put an idol without risking to fry off the brains of the cities' population with the religious field.\n\nEach city has a shape of a convex polygon such that no three vertexes lie on a straight line. The cities can intersect. Each altar should be attached to the city through a special ceremony, besides, it must be situated on the city's territory (possibly at the border). Thus, there may be several altars on a city's territory, but exactly one of them will be attached to the city. The altars, the idol and the hills are points on the plane, some of them may coincide.\n\nThe hills are taken into consideration independently from each other, the altars' location for different hills may also be different."},{"iden":"input","content":"First follow descriptions of the three cities, divided by empty lines. The descriptions are in the following format:\n\nThe first line contains an integer _n_, which represent the number of the polygon's vertexes (3 ≤ _n_ ≤ 5·104). Next _n_ lines contain two integers _x__i_, _y__i_ each, they are the coordinates of the polygon's _i_\\-th vertex in the counterclockwise order.\n\nAfter the cities' description follows the integer _m_ (1 ≤ _m_ ≤ 105), which represents the number of hills. Next _m_ lines each contain two integers _x__j_, _y__j_, they are the coordinates of the _j_\\-th hill.\n\nAll the coordinates in the input data do not exceed 5·108 in the absolute value."},{"iden":"output","content":"For each hill print on a single line \"_YES_\" (without the quotes) or \"_NO_\" (without the quotes), depending on whether the three sacrifice altars can be put to balance the idol or not."},{"iden":"examples","content":"Input\n\n3\n0 0\n1 0\n1 1\n\n4\n8 8\n5 5\n6 4\n8 4\n\n3\n-1 -1\n-3 -1\n-2 -2\n\n5\n0 0\n2 1\n7 1\n1 1\n5 3\n\nOutput\n\nNO\nYES\nNO\nYES\nNO"},{"iden":"note","content":"For the hill at (2, 1) the altars can be placed at the points (1, 0), (7, 5), ( - 2,  - 2), for the hill at (1, 1) — at the points (0, 0), (6, 4), ( - 3,  - 1). Many other groups of three points can do the trick. There are no suitable points for other hills."}],"translated_statement":[{"iden":"statement","content":"很久以前，在美洲的某个深处，有一个由伟大领袖 Pinnie-the-Wooh 统治的强大部落。有一天，这个部落征服了三个玛雅城市。Pinnie-the-Wooh 开始担忧：必须对这些被征服的领土进行控制。因此，他向至高神 Mogohu-Rea 的祭司寻求帮助。\n\n祭司传达了神的旨意：为了控制这三个城市，他应当放置一座 Mogohu-Rea 的神像——这将在城市上空形成一个宗教场。然而，这座神像力量过于强大，若不被恰好三个祭坛平衡，便容易使周围的人发疯。这三个祭坛必须分别放置在每个城市中。为了平衡神像，祭坛的放置方式必须使得这三个点的质心与神像的位置重合。在计算质心时，假设所有祭坛质量相同。\n\n现在 Pinnie-the-Wooh 正在思考将神像放在哪里。他有一份适合放置神像的山丘列表。请帮助他确定在哪几座山丘上可以放置神像，而不会使城市居民的脑部因宗教场而“烧毁”。\n\n每个城市都是一个凸多边形，且没有任何三个顶点共线。城市之间可以相交。每个祭坛必须通过一种特殊仪式与城市绑定，且必须位于城市的领土内（允许在边界上）。因此，一个城市的领土上可能存在多个祭坛，但只有一个会被正式绑定到该城市。祭坛、神像和山丘都是平面上的点，其中一些点可能重合。\n\n各山丘的评估是相互独立的，不同山丘对应的祭坛位置也可以不同。\n\n首先给出三个城市的描述，以空行分隔。每个描述的格式如下：\n\n第一行包含一个整数 #cf_span[n]，表示多边形的顶点数（#cf_span[3 ≤ n ≤ 5·104]）。接下来的 #cf_span[n] 行每行包含两个整数 #cf_span[xi], #cf_span[yi]，分别是多边形第 #cf_span[i] 个顶点的坐标，按逆时针顺序给出。\n\n在三个城市的描述之后，给出一个整数 #cf_span[m]（#cf_span[1 ≤ m ≤ 105]），表示山丘的数量。接下来的 #cf_span[m] 行每行包含两个整数 #cf_span[xj], #cf_span[yj]，分别是第 #cf_span[j] 座山丘的坐标。\n\n输入数据中所有坐标的绝对值均不超过 #cf_span[5·108]。\n\n对于每座山丘，请在一行中输出 \"_YES_\"（不含引号）或 \"_NO_\"（不含引号），表示是否可以放置三个祭坛以平衡神像。\n\n对于坐标为 #cf_span[(2, 1)] 的山丘，祭坛可以放置在点 #cf_span[(1, 0), (7, 5), ( - 2,  - 2)]；对于坐标为 #cf_span[(1, 1)] 的山丘，祭坛可以放置在点 #cf_span[(0, 0), (6, 4), ( - 3,  - 1)]。还有许多其他三元组点也能达成目标。其他山丘则没有合适的放置方案。"},{"iden":"input","content":"首先给出三个城市的描述，以空行分隔。每个描述的格式如下：第一行包含一个整数 #cf_span[n]，表示多边形的顶点数（#cf_span[3 ≤ n ≤ 5·104]）。接下来的 #cf_span[n] 行每行包含两个整数 #cf_span[xi], #cf_span[yi]，分别是多边形第 #cf_span[i] 个顶点的坐标，按逆时针顺序给出。在三个城市的描述之后，给出一个整数 #cf_span[m]（#cf_span[1 ≤ m ≤ 105]），表示山丘的数量。接下来的 #cf_span[m] 行每行包含两个整数 #cf_span[xj], #cf_span[yj]，分别是第 #cf_span[j] 座山丘的坐标。输入数据中所有坐标的绝对值均不超过 #cf_span[5·108]。"},{"iden":"output","content":"对于每座山丘，请在一行中输出 \"_YES_\"（不含引号）或 \"_NO_\"（不含引号），表示是否可以放置三个祭坛以平衡神像。"},{"iden":"examples","content":"输入30 01 01 148 85 56 48 43-1 -1-3 -1-2 -250 02 17 11 15 3输出NOYESNOYESNO"},{"iden":"note","content":"对于坐标为 #cf_span[(2, 1)] 的山丘，祭坛可以放置在点 #cf_span[(1, 0), (7, 5), ( - 2,  - 2)]；对于坐标为 #cf_span[(1, 1)] 的山丘，祭坛可以放置在点 #cf_span[(0, 0), (6, 4), ( - 3,  - 1)]。还有许多其他三元组点也能达成目标。其他山丘则没有合适的放置方案。"}],"sample_group":[],"show_order":[],"formal_statement":"Let $ C_1, C_2, C_3 \\subset \\mathbb{R}^2 $ be the closed convex polygons representing the three cities, each defined by a finite set of vertices in counterclockwise order.\n\nLet $ H = \\{ p_1, p_2, \\dots, p_m \\} \\subset \\mathbb{R}^2 $ be the set of hill locations.\n\nFor a given hill $ p \\in H $, define the set of feasible altar placements as:\n$$\nS_i = C_i \\quad \\text{for } i = 1,2,3\n$$\n\nThe idol at $ p $ is balanced if and only if there exist points $ a_1 \\in C_1 $, $ a_2 \\in C_2 $, $ a_3 \\in C_3 $ such that:\n$$\n\\frac{a_1 + a_2 + a_3}{3} = p\n$$\nwhich is equivalent to:\n$$\na_1 + a_2 + a_3 = 3p\n$$\n\nDefine the Minkowski sum:\n$$\nS = C_1 + C_2 + C_3 = \\{ a_1 + a_2 + a_3 \\mid a_i \\in C_i \\}\n$$\n\nThen, the idol at $ p $ can be balanced if and only if:\n$$\n3p \\in S\n$$\n\n**Output for each hill $ p_j $:**\n- \"_YES_\" if $ 3p_j \\in C_1 + C_2 + C_3 $\n- \"_NO_\" otherwise","simple_statement":null,"has_page_source":false}