#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stck:1024000000,1024000000")
int t, n, m, a[1000006], dp[1000006], x, pos = -1, val_x, val_y;
int main() {
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    scanf("%d", &x);
    pos = (pos >= x ? pos : x);
    a[x]++;
  }
  printf("\n");
  int flag = 0;
  for (int i = 1;; i++)
    if (a[i] != 4 * i) {
      val_x = i;
      break;
    }
  for (int i = 1; i <= t; i++) {
    if (t % i) continue;
    n = i, m = t / i;
    val_y = n + m - pos - val_x;
    memset(dp, 0, sizeof(dp));
    for (int row = 1; row <= n; row++)
      for (int col = 1; col <= m; col++)
        dp[abs(row - val_x) + abs(col - val_y)]++;
    for (int j = 0; j <= pos; j++)
      if (a[j] != dp[j]) goto eg;
    flag = 1;
  eg:;
    if (flag) break;
  }
  if (flag)
    printf("%d %d\n%d %d\n", n, m, val_x, val_y);
  else
    printf("-1\n");
  return 0;
}
