#include <bits/stdc++.h>
using namespace std;
const int AX = 1e6 + 66;
int a[AX];
int t;
int x, y, n, m;
int mp[AX];
bool check() {
  memset(mp, 0, sizeof(mp));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      mp[abs(i - x) + abs(j - y)]++;
    }
  }
  for (int i = 0; i < t; i++) {
    if (mp[i] != a[i]) return false;
  }
  return true;
}
int main() {
  scanf("%d", &t);
  int v;
  int mx = 0;
  for (int i = 0; i < t; i++) {
    scanf("%d", &v);
    mx = max(mx, v);
    a[v]++;
  }
  for (int i = 1; i <= t; i++) {
    if (a[i] != 4 * i) {
      x = i;
      break;
    }
  }
  for (n = 1; n <= t; n++) {
    if (!(t % n)) {
      m = t / n;
      y = n + m - x - mx;
      if (check()) {
        return 0 * printf("%d %d\n%d %d", n, m, x, y);
      }
    }
  }
  printf("-1\n");
  return 0;
}
