Collision of Asteroids

No attempts yetTime limit1sMemory limit16 MB

Problem

Predicting the trajectories and collisions of asteroids is routine work at an observatory. Bob has spent many hours observing two asteroids, so he knows their exact shapes and velocities. After a sleepless night, however, he can no longer tell whether the two asteroids are about to collide or whether they are the debris left over from a past collision.

You are given the shapes of two convex asteroids together with their velocities. Determine whether they have collided in the past or will collide in the future — that is, whether the two bodies share at least one common point at some moment in time.

Each asteroid moves along a straight line at a constant velocity. Gravity is negligible because the asteroids are far from every planet. You may assume that the two asteroids do not share any point at the reference time t=0t = 0.

Input

The input consists of two blocks, one per asteroid. Each asteroid is the convex hull of the points given in its block.

A block begins with a line containing an integer nn (3n500003 \le n \le 50\,000), the number of points. Each of the following nn lines contains three integers xx, yy, and zz (1000000000x,y,z1000000000-1\,000\,000\,000 \le x, y, z \le 1\,000\,000\,000) describing one point. The points are guaranteed not to be coplanar (there exist four of them that do not lie on a common plane). The block ends with a line containing three integers vxv_x, vyv_y, and vzv_z (2000000vx,vy,vz2000000-2\,000\,000 \le v_x, v_y, v_z \le 2\,000\,000), the velocity of the asteroid.

Output

Print YES if the asteroids have collided or will collide (they share a common point at some time), and NO otherwise.