1004_D. Sonya and Matrix
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.

<image> Example of a rhombic matrix.

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

She drew a n× 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⋅ 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× m rhombic matrix whose elements are the same as the elements in the sequence in some order.

Input

The first line contains a single integer t (1≤ t≤ 10^6) — the number of cells in the matrix.

The second line contains t integers a_1, a_2, …, a_t (0≤ a_i< t) — the values in the cells in arbitrary order.

Output

In the first line, print two positive integers n and m (n × m = t) — the size of the matrix.

In the second line, print two integers x and y (1≤ x≤ n, 1≤ y≤ m) — the row number and the column number where the cell with 0 is located.

If there are multiple possible answers, print any of them. If there is no solution, print the single integer -1.

Examples

Input

20
1 0 2 3 5 3 2 1 3 2 3 1 4 2 1 4 2 3 2 4


Output

4 5
2 2


Input

18
2 2 3 2 4 3 3 3 0 2 4 2 1 3 2 1 1 1


Output

3 6
2 3


Input

6
2 1 0 2 1 2


Output

-1

Note

You can see the solution to the first example in the legend. You also can choose the cell (2, 2) for the cell where 0 is located. You also can choose a 5× 4 matrix with zero at (4, 2).

In the second example, there is a 3× 6 matrix, where the zero is located at (2, 3) there.

In the third example, a solution does not exist.
```python
def get(n,m,a,b,t):
    freq=[0]*(t+1)
    for i in range(n):
        for j in range(m):
            val=abs(i-a)+abs(j-b)
            freq[val]+=1
    return freq
t=int(input())
a=list(map(int,input().split()))
mx=max(a)
f=[0]*(t+1)
for i in a:
    f[i]+=1

b=1
for i in range(1,mx+1):
    if f[i]!=4*i:
        b=i
        break
n=1
a=-1
x=0
y=0
mila=False
while n*n<=t:
    if t%n==0:
        m=t//n
        a=n+m-mx-b
        x,y=n,m
        if  a>0 and a<=n and b>0 and b<=m and f==get(n,m,a-1,b-1,t):
            mila=True
            break
        if  a>0 and a<=m and b>0 and b<=n and f==get(n,m,b-1,a-1,t):
            mila=True
            a,b=b,a
            break
    n+=1
if not mila:
    print(-1)
else:
    print(x,y)
    print(a,b)
```