#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
int n, m, k, cnt[MAXN], myCnt[MAXN], ansx, ansy, st, ed, p;
int maxDis;
void getAns(int n, int m, int x, int y) {
  memset(myCnt, 0, sizeof(myCnt));
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      myCnt[abs(i - x) + abs(j - y)]++;
    }
  }
}
void pdAns(int n, int m) {
  ansy = n + m - maxDis - ansx;
  getAns(n, m, min(ansy, ansx), max(ansx, ansy));
}
int main() {
  scanf("%d", &k);
  maxDis = 0;
  for (int i = 1; i <= k; ++i) {
    int num;
    scanf("%d", &num);
    cnt[num]++;
    maxDis = max(maxDis, num);
  }
  for (int i = 1; i < MAXN; ++i) {
    if (cnt[i] != i * 4) {
      ansx = i;
      break;
    }
  }
  bool ans = true;
  for (n = 1; n <= k; ++n) {
    if (k % n != 0) continue;
    m = k / n;
    pdAns(n, m);
    ans = true;
    for (int j = 0; j <= k; ++j) {
      if (myCnt[j] != cnt[j]) {
        ans = false;
        break;
      }
    }
    if (ans) {
      break;
    }
  }
  if (ans) {
    printf("%d %d\n%d %d\n", n, m, ansx, ansy);
  } else {
    printf("-1\n");
  }
  return 0;
}
