#include <bits/stdc++.h>
using namespace std;
const double PI = atan(1.0) * 4;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const long long MOD = 1000000007;
const int maxn = 1000010;
int cnt[maxn];
int c[maxn];
int main() {
  int t, n, m, x, y, a, b, z;
  bool isok = true;
  bool flag = false;
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    scanf("%d", &z);
    cnt[z]++;
  }
  for (int i = 1; i < t; i++) {
    if (cnt[i] % 4 != 0) {
      x = i;
      break;
    }
  }
  for (int i = t; i >= 1; i--) {
    if (cnt[i] != 0) {
      b = i;
      break;
    }
  }
  for (n = x; n < t; n++) {
    if (t % n != 0) continue;
    m = t / n;
    y = n + m - b - x;
    if (y < 1 || y > m) continue;
    memset(c, 0, sizeof(c));
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        int temp = fabs(x - i) + fabs(y - j);
        c[temp]++;
      }
    }
    isok = true;
    for (int i = 1; i < t; i++) {
      if (c[i] != cnt[i]) {
        isok = false;
        break;
      }
    }
    if (isok) {
      flag = true;
      printf("%d %d\n%d %d\n", n, m, x, y);
      break;
    }
  }
  if (!isok) {
    flag = true;
    printf("-1\n");
  }
  if (t == 1) {
    if (cnt[0] == 1)
      printf("1 1\n1 1\n");
    else
      printf("-1\n");
    flag = true;
  }
  if (!flag) printf("-1\n");
  return 0;
}
