#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
long long A[N], B[N], n, xx, mx;
bool check(int n, int m) {
  int x = n - xx, y = mx - x;
  if (x < 0 || x >= n || y < 0 || y >= m) return 0;
  memset(B, 0, sizeof(B));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) ++B[abs(y - j) + abs(i - x)];
  if (!memcmp(A, B, sizeof(A))) {
    printf("%d %d\n%d %d\n", n, m, x + 1, y + 1);
    return 1;
  }
  return 0;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &xx);
    A[xx]++;
    if (xx > mx) mx = xx;
  }
  if (A[0] != 1) {
    printf("-1");
    return 0;
  }
  for (xx = 1; xx <= mx; ++xx)
    if (A[xx] != xx * 4) {
      if (A[xx] > xx * 4) {
        printf("-1");
        return 0;
      } else
        break;
    }
  for (int i = 1; i * i <= n; ++i) {
    if (n % i) continue;
    if (check(i, n / i)) return 0;
    if (check(n / i, i)) return 0;
  }
  printf("-1\n");
  return 0;
}
