#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int data[N];
int temp[N];
int n;
bool check(int nn, int mm, int x, int y) {
  memset(temp, 0, sizeof(temp));
  for (int i = 1; i <= nn; i++) {
    for (int j = 1; j <= mm; j++) {
      int a = abs(i - x) + abs(j - y);
      temp[a]++;
    }
  }
  for (int i = 0; i < n; i++) {
    if (temp[i] != data[i]) return false;
  }
  return true;
}
int dis(int i, int j, int r, int c) { return abs(i - r) + abs(j - c); }
int fac[N];
int main() {
  scanf("%d", &n);
  int maxx = 0;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    maxx = max(maxx, a);
    data[a]++;
  }
  if (n == 1) {
    printf("1 1\n1 1\n");
    return 0;
  }
  int m;
  for (int i = 1; i < n; i++) {
    if (data[i] != 4 * i) {
      m = i;
      break;
    }
  }
  m--;
  int cnt = 0;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) fac[cnt++] = i;
  }
  for (int i = 0; i < cnt; i++) {
    int r = fac[i];
    int c = n / fac[i];
    if (r + c - 2 < maxx) continue;
    for (int j = 1; j <= r; j++) {
      int k = maxx - j + 2;
      if (k >= 1 && k <= c) {
        int minn = min(min(j - 1, r - j), min(k - 1, c - k));
        if (minn == m) {
          if (check(r, c, j, k)) {
            printf("%d %d\n%d %d\n", r, c, j, k);
            return 0;
          }
        }
      }
    }
  }
  printf("-1\n");
  return 0;
}
