#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  if (!b) return a;
  return gcd(b, a % b);
}
const int maxn = 1e6 + 10;
int a[maxn];
int b[maxn];
int main() {
  int n;
  scanf("%d", &n);
  int mx = 0;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    mx = max(mx, x);
    a[x]++;
  }
  int gap = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] != i * 4) {
      gap = i;
      break;
    }
  }
  vector<pair<int, int> > vec;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) vec.push_back(make_pair(i, n / i));
  }
  for (auto p : vec) {
    int row = p.first, col = p.second;
    int ansx = gap, ansy = row + col - mx - ansx;
    if (ansx <= 0 || ansx > row || ansy <= 0 || ansy > col) continue;
    memset(b, 0, sizeof(b));
    for (int i = 1; i <= row; i++) {
      for (int j = 1; j <= col; j++) {
        int dis = ((i - ansx) >= 0 ? (i - ansx) : (-(i - ansx))) +
                  ((j - ansy) >= 0 ? (j - ansy) : (-(j - ansy)));
        b[dis]++;
      }
    }
    bool flg = 1;
    for (int i = 0; i <= mx; i++) {
      if (a[i] != b[i]) {
        flg = 0;
        break;
      }
    }
    if (flg) {
      printf("%d %d\n%d %d\n", row, col, ansx, ansy);
      return 0;
    }
  }
  for (auto p : vec) {
    int row = p.first, col = p.second;
    int ansy = gap, ansx = row + col - mx - ansy;
    if (ansx <= 0 || ansx > row || ansy <= 0 || ansy > col) continue;
    memset(b, 0, sizeof(b));
    for (int i = 1; i <= row; i++) {
      for (int j = 1; j <= col; j++) {
        int dis = ((i - ansx) >= 0 ? (i - ansx) : (-(i - ansx))) +
                  ((j - ansy) >= 0 ? (j - ansy) : (-(j - ansy)));
        b[dis]++;
      }
    }
    bool flg = 1;
    for (int i = 0; i <= mx; i++) {
      if (a[i] != b[i]) {
        flg = 0;
        break;
      }
    }
    if (flg) {
      printf("%d %d\n%d %d\n", row, col, ansx, ansy);
      return 0;
    }
  }
  printf("-1\n");
  return 0;
}
