#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
struct node {
  int u, v, step;
};
int vis[N], tvis[N];
bool solve(int x, int y, int n, int m) {
  memset(tvis, 0, sizeof(tvis));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int tmp = abs(x - i) + abs(y - j);
      tvis[tmp]++;
      if (tvis[tmp] > vis[tmp]) return 0;
    }
  }
  return 1;
}
int main() {
  int n, num;
  scanf("%d", &n);
  memset(vis, 0, sizeof(vis));
  int Max = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &num);
    Max = max(Max, num);
    vis[num]++;
  }
  int flag = 0, x = 0, y;
  for (int i = 1; i <= n; i++) {
    if (vis[i] > i * 4) {
      flag = 1;
      break;
    }
    if (vis[i] == i * 4) continue;
    x = i;
    break;
  }
  if (flag || !x) {
    printf("-1\n");
    return 0;
  }
  int sqr = sqrt(n);
  for (int i = 1; i <= n; i++) {
    if (n % i == 0) {
      y = i + n / i - x - Max;
      if (solve(x, y, i, n / i)) {
        printf("%d %d\n", i, n / i);
        printf("%d %d\n", x, y);
        return 0;
      }
    }
  }
  printf("-1\n");
  return 0;
}
