#include <bits/stdc++.h>
using namespace std;
const int maxm = 1e6 + 10;
int cnt[maxm], d[maxm];
int t, i, j, n, m, x, y, mx, a, flag, flag2;
int main() {
  cin >> t;
  memset(cnt, 0, sizeof(cnt));
  mx = 0;
  for (i = 1; i <= t; i++) {
    cin >> a;
    mx = max(mx, a);
    cnt[a]++;
  }
  x = 1;
  for (i = 1; i < mx; i++) {
    if (cnt[i] != 4 * i) {
      x = i;
      break;
    }
  }
  flag2 = 1;
  for (m = 1; m <= t; m++) {
    n = t / m;
    if (m * n == t) {
      y = m + n - x - mx;
      memset(d, 0, sizeof(d));
      for (i = 1; i <= m; i++) {
        for (j = 1; j <= n; j++) {
          a = abs(x - i) + abs(y - j);
          d[a]++;
        }
      }
      flag = 1;
      for (i = 0; i <= mx; i++) {
        if (cnt[i] != d[i]) {
          flag = 0;
          break;
        }
      }
      if (flag) {
        printf("%d %d\n", m, n);
        printf("%d %d\n", x, y);
        flag2 = 0;
        break;
      }
    }
  }
  if (flag2) {
    cout << -1 << endl;
  }
  return 0;
}
