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