#include <bits/stdc++.h>
using namespace std;
int x1[1000010];
int d[1000010];
int ch[1000010];
int fabs(int n) {
  if (n >= 0)
    return n;
  else
    return -n;
}
bool check(int x, int y, int n, int m) {
  memset(ch, 0, sizeof(ch));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      ch[(fabs(i - x) + fabs(j - y))]++;
    }
  }
  for (int i = 0; i <= n * m; i++) {
    if (ch[i] != d[i]) return false;
  }
  return true;
}
int main() {
  int t, Max = 0, x, n, m, y, flag = 0;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    cin >> x1[i];
    d[x1[i]]++;
    if (x1[i] > Max) Max = x1[i];
  }
  for (int i = 1; i <= t; i++) {
    if (d[i] != 4 * i) {
      x = i;
      break;
    }
  }
  for (n = 1; n <= t; n++) {
    if (t % n == 0) {
      m = t / n;
      y = n + m - x - Max;
      if (check(x, y, n, m)) {
        flag = 1;
        break;
      }
    }
  }
  if (flag)
    cout << n << " " << m << endl << x << " " << y;
  else
    cout << "-1";
}
