404344: GYM101484 E Double Fence
Description
Danfsk bought some sheep and wants to protect them from wolves. He had the brilliant idea of building two convex fences, one strictly inside the other, and keeping all sheep inside the inner fence. This way, the sheep would have a second layer of protection from the wolves.
He hired Tomask, a famous fence architect, to design two fences for him. After finishing his project, Tomask gave Danfsk two pieces of paper, each containing the coordinates of the poles of a convex fence.
Tomask is also famous for miscalculations on his projects, so, before paying Tomask and starting building the fences, Danfsk wants to check if one convex fence is really strictly inside the other in Tomask's project. He asked you to help him with this task.
InputThe first line of the input contains two integers N and M (3 ≤ N, M ≤ 105) indicating respectively the number of poles of the first convex fence and the number of poles of the second convex fence.
Each of the following N lines contains two integers: the i-th line contains xi1 and yi1 ( - 109 ≤ xi1, yi1 ≤ 109), indicating the coordinates of the i-th pole of the first fence.
Each of the following M lines contains two integers: the i-th line contains xi2 and yi2 ( - 109 ≤ xi2, yi2 ≤ 109), indicating the coordinates of the i-th pole of the second fence.
Each fence has the shape of a convex polygon. Pole coordinates of each fence are given in clockwise order. No two points in the project are the same.
Note that there may be colinear poles in the project.
OutputOutput YES if one fence is strictly inside the other (the first fence is strictly inside the second or vice versa). Output NO otherwise.
ExamplesInput4 4Output
1 1
1 -1
-1 -1
-1 1
2 2
2 -2
-2 -2
-2 2
YESInput
4 3Output
0 0
0 3
3 3
3 0
1 1
2 3
2 1
NOInput
3 3Output
2 1
5 1
2 -1
-3 1
0 1
0 -1
NO