Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/if-tortinchi-uch

The fourth corner

Medium 1000 ms 64 MB 43%
Share

Three corners $(x_{1}; y_{1})$, $(x_{2}; y_{2})$ and $(x_{3}; y_{3})$ of a rectangle with sides parallel to the coordinate axes are given in any order. Find the coordinates of its fourth corner.

The fourth corner of a rectangle found from three corners

Input

One line with six integers: $x_{1}$, $y_{1}$, $x_{2}$, $y_{2}$, $x_{3}$ and $y_{3}$.

Output

One line with two integers: the $x$ and $y$ coordinates of the fourth corner.

Note

$-1000 \le x_{1}, y_{1}, x_{2}, y_{2}, x_{3}, y_{3} \le 1000$
The three points are different corners of such a rectangle with a non-zero area.

Examples

Input #1
1 1 1 3 5 3
Output #1
5 1
Input #2
6 -2 -1 4 -1 -2
Output #2
6 4

Sign in to submit a solution

Signing up is free and takes a minute.