#include <bits/stdc++.h>
using namespace std;
int N, tmp, distB, distA, locX, locY;
int exist[1000005], check[1000005];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
void solve(int R, int C) {
  if (locX > R || locX < 1 || locY > C || locY < 1) return;
  int a0 = 0;
  memset(check, 0, sizeof check);
  int dist[R + 1][C + 1];
  for (int i = 1; i <= R; i++) {
    for (int j = 1; j <= C; j++) {
      dist[i][j] = abs(i - locX) + abs(j - locY);
      check[dist[i][j]]++;
      if (check[dist[i][j]] > exist[dist[i][j]]) return;
    }
  }
  printf("%d %d\n%d %d\n", R, C, locX, locY);
  exit(0);
}
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &tmp);
    exist[tmp]++;
    distB = max(tmp, distB);
  }
  if (N == 1) {
    if (exist[0] == 1)
      printf("1 1\n1 1\n");
    else
      printf("-1\n");
    exit(0);
  }
  for (int i = 1; i <= distB; i++) {
    if (exist[i] & 3) {
      locX = i;
      break;
    }
  }
  int sq = sqrt(N);
  for (int i = 1; i <= sq; i++) {
    if (N % i == 0) {
      int j = N / i;
      distA = j + i - distB - 2;
      locY = j + i - locX - distB;
      if (i != j) {
        solve(i, j);
        solve(j, i);
      } else
        solve(i, j);
    }
  }
  printf("-1\n");
}
