401460: GYM100460 F At the Hell's Threshold

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. At the Hell's Thresholdtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Desmond and Thorwald rush to rescue! They are making their way through the secret underground tunnel, magically connecting the human world with Enia. But the tunnel forks into n passages, each having an ancient elven rune carefully painted above. As you might guess, not all the passages lead to Enia: some of them lead to other worlds, most of which are not suitable for life.

Ancient elven runes are the sets of luminous points, in a certain way arranged relative to each other. Each of the runes denotes the name of the world where the corresponding passage leads, in the ancient elven language. Fortunately, one tavern master had sketched the image of the desired rune on a napkin and gave it to the heroes. The image is made not in full size but is oriented correctly, i.e. from the coordinates of points on the image it is possible to get the coordinates of points on the rune by zoom (equal by all directions) and translation.

Input

The first line contains two integers separated by the space: n and m (1 ≤ n ≤ 100, 1 ≤ m ≤ 10000) — the number of passages marked by runes and the number of points each rune made of.

The next lines contains 2m integers each, separated by the spaces: xij and yij ( - 109 ≤ xij, yij ≤  + 109) — the coordinates of the j-th point on the i-th image of the rune. The first image corresponds to tavern master's drawing, and the other n correspond to the runes above passages. For each image, all points on it are different.

Output

Output n lines. In the i-th line output «YES» (without quotes) if the i-th passage leads to Enia, otherwise output «NO» (without quotes) in this line.

ExamplesInput
2 3
3 4 4 6 4 5
-100 -200 100 200 100 0
-3 -4 -4 -6 -4 -5
Output
YES
NO
Input
4 4
0 0 1 2 3 6 5 10
1 1 2 3 4 7 6 11
11 21 3 5 7 13 1 1
-1 -2 0 0 4 8 2 4
0 1 1 3 2 5 3 7
Output
YES
YES
YES
NO

加入题单

上一题 下一题 算法标签: