Since Sonya has just learned the basics of matrices, she decided to play with them a little bit.

Sonya imagined a new type of matrices that she called rhombic matrices. These matrices have exactly one zero, while all other cells have the Manhattan distance to the cell containing the zero. The cells with equal numbers have the form of a rhombus, that is why Sonya called this type so.

The Manhattan distance between two cells ($x_1$, $y_1$) and ($x_2$, $y_2$) is defined as $|x_1 - x_2| + |y_1 - y_2|$. For example, the Manhattan distance between the cells $(5, 2)$ and $(7, 1)$ equals to $|5-7|+|2-1|=3$.

Note that rhombic matrices are uniquely defined by $n$, $m$, and the coordinates of the cell containing the zero.

She drew a $n\times m$ rhombic matrix. She believes that you can not recreate the matrix if she gives you only the elements of this matrix in some arbitrary order (i.e., the sequence of $n\cdot m$ numbers). Note that Sonya will not give you $n$ and $m$, so only the sequence of numbers in this matrix will be at your disposal.

Write a program that finds such an $n\times m$ rhombic matrix whose elements are the same as the elements in the sequence in some order.
The first line contains a single integer $t$ ($1\leq t\leq 10^6$) — the number of cells in the matrix.

The second line contains $t$ integers $a_1, a_2, \ldots, a_t$ ($0\leq a_i&lt; t$) — the values in the cells in arbitrary order.
20
1 0 2 3 5 3 2 1 3 2 3 1 4 2 1 4 2 3 2 4
4 5
2 2
18
2 2 3 2 4 3 3 3 0 2 4 2 1 3 2 1 1 1
3 6
2 3
6
2 1 0 2 1 2
-1
1
0
1 1
1 1
7
0 1 2 3 4 2 6
-1
6
0 0 0 0 0 0
-1
4
0 0 0 0
-1
import sys
import os

def calculate(r, x1, x2, y1, y2):
    result = 0
    s1 = -r if x1 is None else max(x1 + 1, -r)
    s2 = r if y2 is None else min(r, y2 - 1)
    result += max(0, abs(s1) + abs(s2) - r + 1)

    s1 = -r if x1 is None else max(x1 + 1, -r)
    s2 = -r if y1 is None else max(y1 + 1, -r)
    result += max(0, abs(s1) + abs(s2) - r + 1)

    s1 = r if x2 is None else min(r, x2 - 1)
    s2 = -r if y1 is None else max(y1 + 1, -r)
    result += max(0, abs(s1) + abs(s2) - r + 1)

    s1 = r if x2 is None else min(r, x2 - 1)
    s2 = r if y2 is None else min(r, y1 - 1)
    result += max(0, abs(s1) + abs(s2) - r + 1)

    result -= 0 if not x1 is None and x1 >= -r else 1
    result -= 0 if not y1 is None and y1 >= -r else 1
    result -= 0 if not x2 is None and x2 <= r else 1
    result -= 0 if not y2 is None and y2 <= r else 1

    return result

def sonyaAndMatrix(n, a):
    dist = dict()
    for e in a:
        if e not in dist:
            dist[e] = 1
        else:
            dist[e] += 1

    if 0 not in dist or dist[0] != 1:
        return -1

    m = max(a)
    if dist[m] != 4 and dist[m] != 2 and dist[m] != 1:
        return -1

    x1 = None
    x2 = None
    y1 = None
    y2 = None

    for r in range(1, m + 1):
        expected = calculate(r, x1, x2, y1, y2)
        if expected == dist[r]:
            continue
        elif expected == dist[r] + 1:
            if x1 is None:
                x1 = -r
            elif x2 is None:
                x2 = r
            elif y1 is None:
                y1 = -r
            elif y2 is None:
                y2 = r
            else:
                return -1
        elif expected == dist[r] + 2:
            if dist[m] == 4 or dist[m] == 2:
                if x1 is None and x2 is None:
                    x1 = -r
                    x2 = r
                elif y1 is None and y2 is None:
                    y1 = -r
                    y2 = r
                else:
                    return -1
            else:
                if x1 is None and y1 is None:
                    x1 = -r
                    y1 = -r
                elif x1 is None and y2 is None:
                    x1 = -r
                    y2 = r
                elif x2 is None and y1 is None:
                    x2 = r
                    y1 = -r
                elif x2 is None and y2 is None:
                    x2 = r
                    y2 = r
                else:
                    return -1
        elif expected == dist[r] + 3:
            if x1 is None and x2 is None:
                x1 = -r
                x2 = r
                if y1 is None:
                    y1 = -r
                elif y2 is None:
                    y2 = r
                else:
                    return -1
            elif y1 is None and y2 is None:
                y1 = -r
                y2 = r
                if x1 is None:
                    x1 = -r
                elif x2 is None:
                    x2 = r
                else:
                    return -1
            return -1
        elif expected == dist[r] + 4:
            if x1 is None and x2 is None and y1 is None and y2 is None:
                x1 = -r
                x2 = r
                y1 = -r
                y2 = r
            else:
                return -1
        else:
            return -1

    if x1 is None or x2 is None or y1 is None or y2 is None:
        return -1
    return [[x2 - x1 - 1, y2 - y1 - 1], [x2, y2]]

def main():
    n = int(input())
    a = [int(x) for x in input().split()]

    result = sonyaAndMatrix(n, a)
    if result == -1:
        print(result)
    else:
        print(result[0][0], result[0][1])
        print(result[1][0], result[1][1])


if __name__ == '__main__':
    main()