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