Question
Check If Four Points Form a Square
You are given the coordinates of four points on a 2D plane. Your task is to determine whether these four points can form a square.
A square has the following properties:
-
All four sides are of equal length.
-
The two diagonals are of equal length.
-
Adjacent sides are perpendicular.
-
The points can be given in any order.
Input
The input consists of four lines. Each line contains two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression — the coordinates of the KaTeX can only parse string typed expression-th point.
Output
Print "Yes" if the four points form a square. Otherwise, print "No".
Example
Input
0 0
1 0
1 1
0 1
Output
Yes
Explanation
The four points form a square of side length 1 with all angles equal to 90 degrees.
0 0
1 0
1 1
0 1
Output
Yes
Explanation
The four points form a square of side length 1 with all angles equal to 90 degrees.