#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
int t;
vector<int> a;
int cnt[1000010];
int maxA = 0, firstLack = 0;
int cm[1000010];
inline bool isAnswer(int r, int c, int n, int m) {
  memset(cm, 0, sizeof(cm));
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      int d = abs(i - r) + abs(j - c);
      ++cm[d];
      if (cm[d] > cnt[d]) return false;
    }
  }
  return true;
}
bool checkAnswer(int n, int m) {
  int r = firstLack, c = maxA + 1 - (n - firstLack);
  if (isAnswer(r, c, n, m)) {
    cout << n << " " << m << endl;
    cout << r << " " << c << endl;
    return true;
  }
  return false;
}
void solve() {
  cin >> t;
  a = decltype(a)(t);
  memset(cnt, 0, sizeof(cnt));
  for (auto& x : a) {
    cin >> x;
    ++cnt[x];
    maxA = max(maxA, x);
  }
  firstLack = 1;
  while (cnt[firstLack] == firstLack * 4) ++firstLack;
  for (int n = 1; n * n <= t; ++n) {
    if (t % n != 0) continue;
    int m = t / n;
    if (maxA > n + m - 2) continue;
    if (checkAnswer(n, m)) return;
    if (checkAnswer(m, n)) return;
  }
  {
    cout << -1 << endl;
    return;
  };
}
int main(int argc, char* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
  return 0;
}
