#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int cnt[1000005];
int cnt1[1000005];
bool f[1000005];
int main() {
  int t, m;
  scanf("%d", &t);
  for (int i = 1; i <= t; i++) {
    scanf("%d", &a[i]);
    cnt[a[i]]++;
  }
  sort(a + 1, a + t + 1);
  if (t == 1) {
    if (a[1] != 0) {
      puts("-1");
    } else {
      puts("1 1");
      puts("1 1");
    }
    return 0;
  }
  if (a[1] == a[2]) {
    puts("-1");
    return 0;
  }
  int p = 0;
  for (int i = t; i >= 1; i--) {
    if (a[i] == a[t]) p++;
  }
  int tom;
  for (int i = 1; i <= a[t]; i++) {
    if (cnt[i] < 4 * i) {
      tom = i - 1;
      break;
    }
  }
  for (int i = 1; i <= (int)sqrt(t); i++) {
    int x, y, n, m;
    if (t % i == 0) {
      memset(cnt1, 0, sizeof(cnt1));
      n = i;
      m = t / i;
      if (i == 1 && p == 4) continue;
      if (i == 1 && p == 1) {
        x = 1;
        y = a[t] + 1;
        if (y > t) continue;
        for (int j = 1; j <= t; j++) {
          cnt1[abs(j - y)]++;
        }
      }
      if (i == 1 && p == 2) {
        if (t % 2 == 0) continue;
        x = 1;
        y = t / 2 + 1;
        for (int j = 1; j <= t; j++) {
          cnt1[abs(j - y)]++;
        }
      }
      if (i != 1) {
        if (p == 4) {
          if (n % 2 != 1 || m % 2 != 1) continue;
          x = (n + 1) / 2;
          y = (m + 1) / 2;
          for (int j = 1; j <= n; j++)
            for (int k = 1; k <= m; k++) {
              cnt1[abs(j - x) + abs(y - k)]++;
            }
        }
        if (p == 2) {
          if (n % 2 != 1 && m % 2 != 1) continue;
          if (n % 2 != 1) swap(n, m);
          x = (n + 1) / 2;
          y = a[t] - abs(x - 1) + 1;
          if (y > m || y < 1) continue;
          for (int j = 1; j <= n; j++)
            for (int k = 1; k <= m; k++) {
              cnt1[abs(j - x) + abs(y - k)]++;
            }
          bool jerry = false;
          for (int j = 0; j <= a[t]; j++) {
            if (cnt[j] != cnt1[j]) {
              jerry = false;
              break;
            }
          }
          if (jerry) {
            printf("%d %d\n%d %d\n", n, m, x, y);
            return 0;
          }
          if (m % 2 == 1) {
            swap(n, m);
            x = (n + 1) / 2;
            y = a[t] - abs(x - 1) + 1;
            if (y > m || y < 1) continue;
            for (int j = 1; j <= n; j++)
              for (int k = 1; k <= m; k++) {
                cnt1[abs(j - x) + abs(y - k)]++;
              }
          }
        }
        if (p == 1) {
          x = n - tom;
          y = a[t] - abs(x - 1) + 1;
          if (y >= 1 && y <= m) {
            for (int j = 1; j <= n; j++)
              for (int k = 1; k <= m; k++) {
                cnt1[abs(j - x) + abs(y - k)]++;
              }
            bool jerry = true;
            for (int j = 0; j <= a[t]; j++) {
              if (cnt[j] != cnt1[j]) {
                jerry = false;
                break;
              }
            }
            if (jerry) {
              printf("%d %d\n%d %d\n", n, m, x, y);
              return 0;
            }
            memset(cnt1, 0, sizeof(cnt1));
          }
          y = m - tom;
          x = a[t] - abs(y - 1) + 1;
          if (x >= 1 && x <= n) {
            for (int j = 1; j <= n; j++)
              for (int k = 1; k <= m; k++) {
                cnt1[abs(j - x) + abs(y - k)]++;
              }
          }
        }
      }
      bool jerry = true;
      for (int j = 0; j <= a[t]; j++) {
        if (cnt[j] != cnt1[j]) {
          jerry = false;
          break;
        }
      }
      if (jerry) {
        printf("%d %d\n%d %d\n", n, m, x, y);
        return 0;
      }
    }
  }
  puts("-1");
  return 0;
}
