#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int a[N], c[N];
int tot;
int t, id;
void check(int n, int m, int x, int y) {
  memset(a, 0, sizeof a);
  for (int i(1); i <= (n); ++i) {
    for (int j(1); j <= (m); ++j) {
      a[abs(i - x) + abs(j - y)]++;
    }
  }
  for (int i(0); i <= (tot); ++i)
    if (a[i] != c[i]) return;
  printf("%d %d\n%d %d\n", n, m, x, y);
  exit(0);
}
int main() {
  scanf("%d", &t);
  for (int i(1); i <= (t); ++i) {
    int x;
    scanf("%d", &x);
    ++c[x];
    tot = max(tot, x);
  }
  id = 1;
  for (int i(1); i <= (tot); ++i)
    if (c[i] != 4 * i) {
      id = i;
      break;
    }
  for (int i = 1; i * i <= t; ++i) {
    if (t % i) continue;
    int n = i, m = t / i, x = id, y = n + m - tot - id;
    if (x > 0 && y > 0 && x <= n && y <= m) {
      check(n, m, x, y);
    }
    n = t / i, m = i, x = id, y = n + m - tot - id;
    if (x > 0 && y > 0 && x <= n && y <= m) {
      check(n, m, x, y);
    }
  }
  return 0 * puts("-1");
}
