Given two opposite corners of an axis-aligned square, construct the other two corners or report that it is impossible.
You are given the coordinates of two distinct points in the plane. Your task is to determine whether these points can be two vertices of an axis-aligned square.
If they can, output the coordinates of the other two vertices of such a square. If multiple answers are possible, any valid one is accepted.
If the two given points cannot be two vertices of an axis-aligned square, output -1.
Two lines, each containing two integers and — the coordinates of the given points.
If it is possible to form an axis-aligned square, print two lines with the coordinates of the remaining two vertices. Otherwise, print -1.
Example 1
Input
0 0 0 1
Output
1 0 1 1
Explanation
The given points are the left side of a unit square. The other two vertices are at x = 1.
Example 2
Input
0 0 1 1
Output
-1
Explanation
These points cannot be two vertices of an axis-aligned square.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.