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=0.
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 n (3≤n≤50000), the number of points. Each of the following n lines contains three integers x, y, and z (−1000000000≤x,y,z≤1000000000) 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 vx, vy, and vz (−2000000≤vx,vy,vz≤2000000), the velocity of the asteroid.
Print YES if the asteroids have collided or will collide (they share a common point at some time), and NO otherwise.