#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int cnt[N], t, b = 0, rec[N];
int main() {
  scanf("%d", &t);
  for (int i = 1; i <= t; i++) {
    int x;
    scanf("%d", &x);
    b = max(b, x);
    ++cnt[x];
  }
  int x, y;
  for (int i = 1; i <= t; i++) {
    if (cnt[i] != 4 * i) {
      x = i;
      break;
    }
  }
  for (int i = 1; i <= t; i++) {
    if (t % i == 0) {
      memset(rec, 0, sizeof(rec));
      int n = i, m = t / i;
      y = n - x + m - b;
      for (int p = 1; p <= n; p++) {
        for (int q = 1; q <= m; q++) {
          ++rec[abs(p - x) + abs(q - y)];
        }
      }
      int ok = 1;
      for (int j = 0; j < t; j++) {
        if (rec[j] != cnt[j]) {
          ok = 0;
          break;
        }
      }
      if (ok) {
        printf("%d %d\n", n, m);
        printf("%d %d\n", x, y);
        return 0;
      }
    }
  }
  puts("-1");
  return 0;
}
