Silver chain
This is not the time to ask questions! The History Museum in London houses a 19th-century silver chain that belonged to Queen Victoria herself. Johnny English will have to get it to give as a ransom for secret documents. Johnny will be able to get into the museum at night without any problems, but the stolen chain needs to be replaced with something so that the loss is not noticed too quickly. Johnny has another chain with him. He wants to replace the chain in the museum with his own.
The chain in the museum is fixed and represents a closed polygonal line, the links of which are segments. Johnny English's chain, lying on the table in front of him, is also a closed polygonal line, the links of which are segments. Johnny wonders if he can fix his chain in the museum, in place of the stolen one, so that he gets exactly the same polygonal line as the one formed by the chain in the museum. In particular, if the chain in the museum covers one segment several times, then Johnny wants his chain to cover this segment the same number of times. Johnny can bend his chain in arbitrary places, not just at the ends of the links.
Polylines can have self-intersections, links of zero length, and overlapping links.
Input
The first line contains one integer n (3 ≤ n ≤ 1000) - the number of vertices of the polyline representing the chain in the museum. The next n lines contain the coordinates of the vertices of the first polyline in the order x[i]
, y[i]
(|x[i]
|, |y[i]
| ≤ ** 1000**). The next line contains one integer m (3 ≤ m ≤ 1000) - the number of vertices of the polyline representing Johnny's chain. The next m lines contain the coordinates of the vertices of the second polyline in the order x[i]
, y[i]
(|x[i]
|, |y[i]
| ≤ ** 1000**).
Output
On a single line print "Yes" if Johnny can fix his chain exactly like the one kept in the museum. And "No" otherwise.