#include <bits/stdc++.h>
using namespace std;
long long r;
long long maxm;
long long counter[1000000 + 5];
long long c[1000000 + 5];
bool check(long long p, long long q, long long n, long long m) {
  for (long long i = 0; i <= maxm; i++) {
    c[i] = 0;
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      c[abs(i - p) + abs(j - q)]++;
    }
  }
  for (long long i = 0; i <= maxm; i++) {
    if (c[i] != counter[i]) {
      return false;
    }
  }
  return true;
}
bool func(long long n, long long m) {
  long long p = r;
  if (p < 1 || p > n) {
    return false;
  }
  long long q = m + n - maxm - p;
  if (q < 1 || q > m) {
    return false;
  }
  if (check(p, q, n, m)) {
    cout << n << " " << m << endl;
    cout << p << " " << q << endl;
    return true;
  }
  q = r;
  if (q < 1 || q > m) {
    return false;
  }
  p = m + n - maxm - q;
  if (p < 1 || p > n) {
    return false;
  }
  if (check(p, q, n, m)) {
    cout << n << " " << m << endl;
    cout << p << " " << q << endl;
    return true;
  }
  return false;
}
int main() {
  long long t;
  cin >> t;
  long long arr[t + 5];
  for (long long i = 0; i < t; i++) {
    counter[i] = 0;
  }
  maxm = 0;
  for (long long i = 0; i < t; i++) {
    cin >> arr[i];
    counter[arr[i]]++;
    maxm = max(maxm, arr[i]);
  }
  if (counter[0] != 1) {
    cout << -1 << endl;
    return 0;
  } else {
    r = -1;
    for (long long i = 1; i <= maxm; i++) {
      if (counter[i] != 4 * i) {
        r = i;
        break;
      }
    }
    if (r == -1) {
      cout << 1 << " " << 1 << endl;
      cout << 1 << " " << 1 << endl;
      return 0;
    }
    for (long long i = 1; i * i <= t; i++) {
      if (t % i == 0) {
        if (func(i, t / i)) {
          return 0;
        }
      }
    }
  }
  cout << -1 << endl;
  return 0;
}
