#include <bits/stdc++.h>
using namespace std;
int a[2000011], aa[2000011];
int main() {
  int nm, temp, b = 0;
  scanf("%d", &nm);
  for (int i = 1; i <= nm; i++) {
    scanf("%d", &temp);
    if (temp > b) b = temp;
    a[temp]++;
  }
  int x = 1, y, fff = 1;
  while (a[x] == 4 * x) x++;
  for (int n = 1; n <= nm; n++)
    if (nm % n == 0) {
      int m = nm / n;
      y = n + m - x - b;
      memset(aa, 0, sizeof(aa));
      for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++) aa[abs(x - i) + abs(y - j)]++;
      int flag = 1;
      for (int i = 0; i <= b; i++)
        if (aa[i] != a[i]) {
          flag = 0;
          break;
        }
      if (flag) {
        fff = 0;
        printf("%d %d\n%d %d\n", n, m, x, y);
        break;
      }
    }
  if (fff) puts("-1");
  return 0;
}
