#include <bits/stdc++.h>
using namespace std;
bool isValid(int n, int m, int x, int y, vector<int> &counter) {
  int max_so_far = 0;
  vector<int> local_counter(counter.size(), 0);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int dist = abs(x - i) + abs(y - j);
      max_so_far = max(max_so_far, dist);
      local_counter[dist]++;
    }
  }
  for (int i = 1; i <= max_so_far; i++) {
    if (local_counter[i] != counter[i]) return false;
  }
  return true;
}
int main() {
  int t;
  int val = 0;
  int x = 1, y = 1, a = 0, b = 0, m, n;
  cin >> t;
  vector<int> counter(1000004, 0);
  for (int i = 0; i < t; i++) {
    cin >> val;
    counter[val]++;
    b = max(b, val);
  }
  for (int i = 1; i <= b; i++) {
    if (counter[i] != 4 * i) {
      x = i;
      break;
    }
  }
  bool found = false;
  for (n = 1; n <= t; n++) {
    m = t / n;
    if (t % n == 0) {
      y = m + n - x - b;
      a = m + n - b - 2;
      if (x <= n && y > 0 && y <= m && a >= 0) {
        if (isValid(n, m, x, y, counter)) {
          found = true;
          break;
        }
      }
    }
  }
  if (found) {
    cout << n << " " << m << endl;
    cout << x << " " << y << endl;
  } else {
    cout << "-1" << endl;
  }
}
