#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int num[1000005];
int t;
int nu[1000005];
bool c(int n, int m, int x, int y) {
  for (int i = 0; i <= t; i++) nu[i] = num[i];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int c = abs(i - x) + abs(j - y);
      nu[c]--;
      if (nu[c] == -1) {
        return 0;
      }
    }
  }
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  int b = 0;
  for (int i = 1; i <= t; i++) {
    cin >> a[i];
    num[a[i]]++;
    b = max(b, a[i]);
  }
  int x = 1;
  for (int i = 1; i <= t; i++) {
    if (num[i] && num[i] % 4) {
      x = i;
      break;
    }
  }
  int n = 2 * x - 2;
  int y = 0, m;
  for (int i = n; i <= t; i++) {
    if (!i) continue;
    if (t % i == 0) {
      m = t / i;
      y = i + m - b - x;
      if (c(i, m, x, y)) {
        cout << i << ' ' << m << endl;
        cout << x << ' ' << y << endl;
        return 0;
      }
    }
  }
  cout << -1 << endl;
  return 0;
}
