#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int b[1000005];
int main() {
  int n;
  scanf("%d", &n);
  memset(a, 0, sizeof(a));
  int maxx = 0;
  for (int i = 0; i < n; i++) {
    int p;
    scanf("%d", &p);
    if (p > maxx) maxx = p;
    a[p]++;
  }
  if (n == 1) {
    printf("1 1\n1 1\n");
    return 0;
  }
  int usf = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] != 4 * i) {
      usf = i;
      break;
    }
  }
  int fl = 0;
  for (int i = 1; i <= n; i++) {
    if (n % i == 0) {
      int x = i, y = n / i;
      int x0 = usf;
      int y0 = x + y - x0 - maxx;
      if (x0 > x || y0 > y) continue;
      memset(b, 0, sizeof(b));
      int fla = 0;
      for (int i = 1; i <= x; i++) {
        int flag = 0;
        for (int j = 1; j <= y; j++) {
          int pp = abs(x0 - i) + abs(y0 - j);
          b[pp]++;
          if (b[pp] > a[pp]) {
            flag = 1;
            break;
          }
        }
        if (flag == 1) {
          fla = 1;
          break;
        }
      }
      if (fla == 0) {
        printf("%d %d\n%d %d\n", x, y, x0, y0);
        return 0;
      }
    }
  }
  printf("-1\n");
}
