#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int mx = 40;
const int mod = 1e9 + 5;
const long long inf = 34359738370;
const int INF = 1e9 + 5;
int c[maxn];
int t, n, m, x = 1, y, maxx;
int c1[maxn];
int dis(int a, int b) { return abs(a - x) + abs(b - y); }
bool check() {
  for (int k = 0; k < t; k++) {
    if (c[k] != c1[k]) {
      return 0;
    }
  }
  return 1;
}
int main() {
  bool ok = 0;
  scanf("%d", &t);
  for (int i = 1; i <= t; i++) {
    int a;
    scanf("%d", &a);
    ++c[a];
    maxx = max(maxx, a);
  }
  for (int i = 1; i <= t; i++) {
    if (c[i] != i * 4) {
      x = i;
      break;
    }
  }
  for (int i = 1; i <= t; i++) {
    if (t % i) continue;
    n = i, m = t / i;
    y = n - x + m - maxx;
    if (x < 1 || x > n || y < 1 || y > m) continue;
    memset(c1, 0, sizeof(c1));
    for (int k = 1; k <= n; k++) {
      for (int l = 1; l <= m; l++) {
        ++c1[dis(k, l)];
      }
    }
    if (check()) {
      printf("%d %d\n%d %d\n", n, m, x, y);
      ok = 1;
      break;
    }
  }
  if (!ok) puts("-1");
  return 0;
}
