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
def i_ints():
    return map(int, input().split())


def check(w, h, x, y, c):
    counts = Counter(chain.from_iterable(range(abs(i-x), abs(i-x)+y) for i in range(1, w+1)))
    counts += Counter(chain.from_iterable(range(abs(i-x)+1, abs(i-x)+1+(h-y)) for i in range(1, w+1)))
    return c == counts


t, = i_ints()
a = Counter(i_ints())

i = 0
for i in range(1, t+1):
    if a[i] != 4 * i:
        break
x = i
B = max(a)


def main():
    
    for w in range(1, int(t**0.5)+2):
        if t % w:
            continue
        h = t // w
        y = w + h - B - x
        if check(w, h, x, y, a):
            return "%s %s\n%s %s" % (w, h, x, y)
        
    return -1
print(main())