#include <bits/stdc++.h>
using namespace std;
long long arr[1000005];
long long cnt[1000005];
long long mat[1000005];
bool check(long long n, long long m, long long posx, long long posy) {
  if (posx <= 0 || posx > n || posy <= 0 || posy > m) return false;
  memset(mat, 0, sizeof mat);
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      long long dis = abs(posx - i) + abs(posy - j);
      mat[dis]++;
    }
  }
  for (long long i = 1; i <= n * m; i++) {
    if (cnt[i] != mat[i]) return false;
  }
  return true;
}
int main() {
  long long i, j, k, l, m, n, o;
  long long testcase;
  long long input, flag, tag, ans;
  long long t;
  scanf("%lld", &t);
  long long b = 0;
  for (i = 1; i <= t; i++) {
    scanf("%lld", &arr[i]);
    cnt[arr[i]]++;
    b = max(b, arr[i]);
  }
  if (cnt[0] != 1) {
    cout << -1 << endl;
    return 0;
  }
  long long posx = -1, posy = -1;
  for (i = 1; i <= t; i++) {
    if (cnt[i] != (4 * i)) {
      posx = i;
      break;
    }
  }
  if (posx == -1) {
    cout << -1 << endl;
    return 0;
  }
  for (n = 1; n <= t; n++) {
    if (t % n) continue;
    m = t / n;
    posy = n + m - b - posx;
    if (check(n, m, posx, posy)) {
      cout << n << " " << m << endl << posx << " " << posy << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}
