#include <bits/stdc++.h>
using namespace std;
int frec[1000005];
int cnt[1000005];
void vadim() {
  cout << "-1\n";
  return;
}
void boris() {
  cout << "1 1\n1 1\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t, mx = 0;
  cin >> t;
  if (t == 1) {
    boris();
    return 0;
  }
  for (int i = 0; i < t; i++) {
    int a;
    cin >> a;
    frec[a]++;
    mx = max(mx, a);
  }
  if (frec[0] != 1) {
    vadim();
    return 0;
  }
  int x;
  for (int i = 1; i <= mx; i++) {
    if (frec[i] > i * 4) {
      vadim();
      return 0;
    }
    if (frec[i] < i * 4) {
      x = i;
      break;
    }
  }
  vector<pair<int, int> > siz;
  for (int i = 1; i <= t; i++) {
    if (t % i == 0) siz.push_back({i, t / i});
  }
  for (int i = 0; i < siz.size(); i++) {
    memset(cnt, 0, sizeof cnt);
    int m = siz[i].first;
    int n = siz[i].second;
    int y = n + m - mx - x;
    for (int i = 1; i <= m; i++) {
      for (int j = 1; j <= n; j++) cnt[abs(i - x) + abs(j - y)]++;
    }
    bool good = 1;
    for (int i = 1; i <= mx; i++) {
      if (cnt[i] != frec[i]) {
        good = 0;
        break;
      }
    }
    if (good) {
      cout << m << ' ' << n << '\n' << x << ' ' << y << '\n';
      return 0;
    }
  }
  vadim();
}
