#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1123456;
int cur[MAXN], ori[MAXN];
const int N = 1000010;
int t, maxv = -1;
void ok(int n, int m, int x, int y) {
  if (x >= 0 && x < n && y >= 0 && y < m) {
    memset(cur, 0, sizeof(cur));
    for (int i = 0; i < (n); ++i)
      for (int j = 0; j < (m); ++j) {
        int d = abs(i - x) + abs(j - y);
        if (d > maxv) return;
        ++cur[abs(i - x) + abs(j - y)];
      }
    bool ok = true;
    for (int i = 0; i < (maxv + 1); ++i)
      if (cur[i] != ori[i]) {
        ok = false;
        break;
      }
    if (ok) {
      cout << n << " " << m << endl;
      cout << x + 1 << " " << y + 1 << endl;
      exit(0);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> t;
  for (int i = 0; i < (t); ++i) {
    int x;
    cin >> x;
    ++ori[x];
    maxv = max(maxv, x);
  }
  int d;
  for (int i = 1; i < (t + 1); ++i)
    if (ori[i] != 4 * i) {
      d = i;
      break;
    }
  for (int i = 1; i < (t + 1); ++i)
    if (!(t % i)) {
      int n = i, m = t / i;
      for (int x : {d - 1, n - d}) {
        int y = maxv - x;
        ok(n, m, x, y);
      }
      for (int y : {d - 1, m - d}) {
        int x = maxv - y;
        ok(n, m, x, y);
      }
    }
  cout << -1 << endl;
  return 0;
}
