#include <bits/stdc++.h>
using namespace std;
const int N = 1000 * 1000 + 100;
vector<int> sdohiusdfh;
int max_number;
int border_dist;
void check(int w, int h, int x, int y) {
  if (x < 0 || x >= w) return;
  if (y < 0 || y >= h) return;
  auto v = sdohiusdfh;
  for (int i = 0; i < w; ++i) {
    for (int j = 0; j < h; ++j) {
      int sum = abs(i - x) + abs(j - y);
      v[sum]--;
      if (v[sum] < 0) return;
    }
  }
  cout << w << " " << h << endl;
  cout << x + 1 << " " << y + 1 << endl;
  exit(0);
}
void check(int w, int h) {
  check(w, h, border_dist, max_number - border_dist);
  check(w, h, max_number - border_dist, border_dist);
  check(w, h, w - border_dist - 1, max_number - (w - border_dist - 1));
  check(w, h, max_number - (h - border_dist - 1), h - border_dist - 1);
}
void solve() {
  int cnt;
  cin >> cnt;
  sdohiusdfh.assign(N, 0);
  for (int i = 0; i < cnt; ++i) {
    int x;
    cin >> x;
    sdohiusdfh[x]++;
  }
  max_number = 0;
  border_dist = 0;
  for (int i = 0; i < N; ++i) {
    if (sdohiusdfh[i]) max_number = i;
    if (sdohiusdfh[i] == i * 4) border_dist = i;
  }
  for (int n = 1; n * n <= cnt; ++n) {
    if (cnt % n) continue;
    int w = n;
    int h = cnt / n;
    check(w, h);
    check(h, w);
  }
  cout << -1 << endl;
}
int main() {
  cout.setf(ios::fixed);
  cout.precision(9);
  solve();
  return 0;
}
