#include <bits/stdc++.h>
using namespace std;
int t, n, m, x, y, b, fl, temp;
vector<int> m1(1e6 + 5, 0), m2(1e6 + 5, 0);
bool check() {
  if (x < 1 || x > n || y < 1 || y > m) return false;
  return true;
}
int calc(long long int p) { return n + m - b - p; }
bool create() {
  vector<vector<int> > vis(n + 2, vector<int>(m + 2, 0)),
      dis(n + 2, vector<int>(m + 2, 0));
  queue<pair<int, int> > q;
  int ix[] = {1, 0, -1, 0};
  int iy[] = {0, 1, 0, -1};
  vis[x][y] = 1;
  q.push({x, y});
  while (!q.empty()) {
    pair<int, int> temp = q.front();
    q.pop();
    for (long long int i = 0; i <= 3; i++) {
      int xx = temp.first + ix[i], yy = temp.second + iy[i];
      if (xx < 1 || xx > n || yy < 1 || yy > m) continue;
      if (vis[xx][yy] != 0) continue;
      vis[xx][yy] = 1;
      dis[xx][yy] = dis[temp.first][temp.second] + 1;
      q.push({xx, yy});
    }
  }
  for (long long int i = 1; i <= n; i++)
    for (long long int j = 1; j <= m; j++) m2[dis[i][j]]++;
  int tr = 1;
  for (long long int i = 0; i <= t - 1; i++) {
    if (m1[i] != m2[i]) tr = 0;
  }
  for (long long int i = 0; i <= t; i++) m2[i] = 0;
  if (tr) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> t;
  vector<int> v(t);
  for (long long int i = 0; i <= t - 1; i++) cin >> v[i];
  sort((v).begin(), (v).end());
  b = v[t - 1];
  for (long long int i = 0; i <= t - 1; i++) m1[v[i]]++;
  for (long long int i = 1; i <= t - 1; i++) {
    if (m1[i] % 4 != 0) {
      temp = i;
      break;
    }
  }
  if (temp == 0) {
    int sq = sqrt(t);
    if (sq * sq != t || sq % 2 == 0) {
      cout << -1 << "\n";
      return 0;
    }
    n = m = sq;
    x = y = (sq + 1) / 2;
    if (create()) {
      cout << n << " " << m << "\n";
      cout << x << " " << y << "\n";
      fl = 1;
    }
    if (!fl) cout << -1 << "\n";
    return 0;
  }
  for (long long int i = 1; i <= sqrt(t); i++) {
    if (t % i == 0) {
      n = i, m = t / i;
      x = temp;
      y = calc(x);
      if (check()) {
        if (create()) {
          cout << n << " " << m << "\n";
          cout << x << " " << y << "\n";
          fl = 1;
          break;
        }
      }
    }
    if (t % i == 0) {
      n = i, m = t / i;
      y = temp;
      x = calc(y);
      if (check()) {
        if (create()) {
          cout << n << " " << m << "\n";
          cout << x << " " << y << "\n";
          fl = 1;
          break;
        }
      }
    }
  }
  if (!fl) cout << -1 << "\n";
}
