Geometry
Geometry-08
Geometry-09
Geometry-10
~/algor $ cat problems/oxshash-uchburchaklar
Similar triangles?
Medium
1000 ms
128 MB
47%
Two triangles are given on the plane by the coordinates of their vertices; both have positive area. Are they similar, that is, can one of them be scaled up or down, rotated, shifted and, if necessary, mirrored so that it exactly coincides with the other? If so, print YES, otherwise print NO.
Input
The first line contains six integers — the vertices of the first triangle: $x_{1}$ $y_{1}$ $x_{2}$ $y_{2}$ $x_{3}$ $y_{3}$.
The second line contains six integers in the same way — the vertices of the second triangle.
Output
YES or NO.
Note
all coordinates are from $-10^{5}$ to $10^{5}$
Examples
Input #1
0 0 4 0 0 3 1 1 1 9 7 1
Output #1
YES
Input #2
0 0 2 0 0 2 0 0 3 0 0 1
Output #2
NO