#include <bits/stdc++.h>
using namespace std;
const int NN = 1272727;
int N[NN], num[NN], t, mx;
void add(int L, int R) {
  if (L > R) swap(L, R);
  for (int i = 0; i < L - 1; i++) num[i] += i + 1;
  for (int i = R; i <= L + R - 2; i++) num[i] += (L + R - 1) - i;
  for (int i = L - 1; i < R; i++) num[i] += L;
}
void calc(int n, int m, int x, int y) {
  for (int i = 0; i <= mx; i++) num[i] = 0;
  int L, R;
  L = x, R = y;
  add(L, R);
  L = n - x + 1;
  add(L, R);
  R = m - y + 1;
  add(L, R);
  L = x;
  add(L, R);
  num[0] -= 3;
  for (int i = 1; i < x; i++) num[i]--;
  for (int i = 1; i < y; i++) num[i]--;
  for (int i = 1; i <= n - x; i++) num[i]--;
  for (int i = 1; i <= m - y; i++) num[i]--;
}
bool ok() {
  for (int i = 0; i <= mx; i++)
    if (N[i] != num[i]) return 0;
  return 1;
}
inline char gchar() {
  static char fjf[2020], *a_st = fjf, *a_ed = fjf;
  if (a_st == a_ed) {
    int len = fread(fjf, 1, 2020, stdin);
    if (!len) return -1;
    a_st = fjf, a_ed = fjf + len;
  }
  return *(a_st++);
}
inline bool gn(int &x) {
  char c, sg = 0;
  while (c = gchar(), (c < '0' || '9' < c) && c != '-' && ~c)
    ;
  if (!~c) return false;
  if (c == '-') sg = 1, c = gchar();
  for (x = 0; '0' <= c && c <= '9'; c = gchar())
    x = (x << 1) + (x << 3) + c - '0';
  if (sg) x = -x;
  return true;
}
int main() {
  gn(t);
  for (int i = 1, val; i <= t; i++) gn(val), N[val]++, mx = max(mx, val);
  int V, H, X, Y;
  int fl = 0;
  for (int i = 1; i * i <= t; i++) {
    if (t % i) continue;
    int n = i, m = t / i;
    for (int x = 1; x <= (n + 1) / 2; x++) {
      int y = n + m - x - mx;
      if (y > (m + 1) / 2 or y < 1) continue;
      calc(n, m, x, y);
      fl = ok();
      if (fl) {
        V = n, H = m, X = x, Y = y;
        break;
      }
    }
    if (fl) break;
  }
  if (fl)
    printf("%d %d\n%d %d\n", V, H, X, Y);
  else
    puts("-1");
  return 0;
}
