#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const long long llinf = (long long)3e18;
const int N = (int)1e6 + 111;
const long double PI = (long double)acos(-1);
int cnt1[N], cnt[N];
int main() {
  int t, x, mx = 0, len = 0, n, m;
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    scanf("%d", &x);
    cnt[x]++;
    mx = max(mx, x);
  }
  n = mx;
  for (int i = 1; i < mx; i++)
    if (4 * i != cnt[i]) {
      len = i - 1;
      break;
    }
  for (n = 1; n * n <= t; n++)
    if (t % n == 0) {
      m = t / n;
      for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
          if (min(min(i, n - 1 - i), min(j, m - 1 - j)) == len &&
              max(i, n - 1 - i) + max(j, n - 1 - j) == mx) {
            for (int cur = 0; cur <= mx; cur++) cnt1[cur] = 0;
            bool ok = true;
            for (int ii = 0; ii < n; ii++)
              for (int jj = 0; jj < m; jj++) cnt1[abs(i - ii) + abs(j - jj)]++;
            for (int cur = 0; cur <= mx; cur++)
              if (cnt1[cur] != cnt[cur]) ok = false;
            if (ok) {
              printf("%d %d\n%d %d", n, m, i + 1, j + 1);
              return 0;
            }
          }
    }
  printf("-1");
}
