#include <bits/stdc++.h>
const int INF = (int)1e9;
const long long INFl = (long long)1e18;
std::vector<int> count((int)1e7, 0);
int atsy, atsx;
int a, b;
int N, M;
int t;
bool check() {
  std::vector<int> copy((int)1e7, 0);
  for (int i = 1; i <= M; ++i) {
    for (int j = 1; j <= N; ++j) {
      copy[std::abs(i - atsy) + std::abs(j - atsx)]++;
    }
  }
  return copy == count;
}
int main() {
  std::cin >> t;
  int c;
  b = 0;
  for (int i = 0; i < t; ++i) {
    std::cin >> c;
    b = std::max(b, c);
    count[c]++;
  }
  int end = 1;
  while (count[end] == end * 4) end++;
  atsx = end;
  for (int i = atsx; i * i <= t; ++i) {
    if (t % i != 0) continue;
    N = i;
    M = t / i;
    atsy = N + M - atsx - b;
    if (M >= atsy)
      if (check()) return !printf("%d %d\n%d %d\n", N, M, atsx, atsy);
    N = t / i;
    M = i;
    atsy = N + M - atsx - b;
    if (M >= atsy && N >= atsx)
      if (check()) return !printf("%d %d\n%d %d\n", N, M, atsx, atsy);
  }
  return !printf("-1\n");
}
