#include <bits/stdc++.h>
using namespace std;
int t, a[1000010], cnt[1000010], b[1000010], maxn;
int n, m, x, y, flag;
int check() {
  if (x <= n && x >= 1 && y >= 1 && y <= m) {
    memset(b, 0, sizeof(b));
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        int z = abs(i - x) + abs(j - y);
        b[z]++;
      }
    for (int i = 1; i <= maxn; i++) {
      if (b[i] != cnt[i]) return 0;
    }
    return 1;
  }
  return 0;
}
int main() {
  cin >> t;
  for (int i = 1; i <= t; i++) cin >> a[i], cnt[a[i]]++, maxn = max(a[i], maxn);
  if (cnt[0] > 1) {
    cout << "-1";
    return 0;
  }
  if (t == 1 && a[1] == 0) {
    cout << 1 << " " << 1 << endl;
    cout << 1 << " " << 1 << endl;
    return 0;
  }
  for (int i = 1; i <= maxn; i++)
    if (cnt[i] != (i << 2)) {
      x = i;
      break;
    }
  for (int i = 1; i <= t; i++) {
    if (t % i) continue;
    n = i;
    m = t / n;
    y = n + m - x - maxn;
    if (check()) {
      flag = 1;
      break;
    }
  }
  if (flag)
    cout << n << " " << m << endl << x << " " << y;
  else
    cout << "-1";
  return 0;
}
