#include <bits/stdc++.h>
using namespace std;
char buf[25];
const int maxn = 1000010;
int a[maxn * 2], b[maxn * 2];
int n, m, x, y, t, mx;
int read() {
  int x = 0, f = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return f ? -x : x;
}
void write(int x) {
  if (!x) {
    putchar('0');
    return;
  }
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  int cnt = 0;
  while (x) {
    buf[++cnt] = '0' + x % 10;
    x /= 10;
  }
  for (int i = cnt; i >= 1; --i) putchar(buf[i]);
}
int main() {
  t = read();
  for (int i = 1; i <= t; ++i) {
    int v = read();
    mx = max(mx, v);
    ++a[v];
  }
  int x = 1;
  for (int i = 1; i <= mx; ++i)
    if (a[i] != i * 4) {
      x = i;
      break;
    }
  for (int i = x * 2 - 1; i <= t; ++i)
    if (t % i == 0) {
      n = i;
      m = t / i;
      y = n + m - x - mx;
      if (y <= 0 || y * 2 - 1 > m) continue;
      bool flag = true;
      int t1 = 0, t2 = 0;
      for (int j = 1; j <= n; ++j) {
        bool f = true;
        for (int k = 1; k <= m; ++k) {
          t1 = j;
          t2 = k;
          int tmp = abs(j - x) + abs(k - y);
          ++b[tmp];
          if (b[tmp] > a[tmp]) {
            flag = false;
            f = false;
            break;
          }
        }
        if (!f) break;
      }
      for (int j = 1; j <= n; ++j) {
        bool f = true;
        for (int k = 1; k <= m; ++k) {
          int tmp = abs(j - x) + abs(k - y);
          --b[tmp];
          if (j == t1 && k == t2) {
            f = false;
            break;
          }
        }
        if (!f) break;
      }
      if (flag) {
        write(n);
        putchar(' ');
        write(m);
        putchar('\n');
        write(x);
        putchar(' ');
        write(y);
        putchar('\n');
        return 0;
      }
    }
  write(-1);
  putchar('\n');
  return 0;
}
