#include <bits/stdc++.h>
using namespace std;
const int N = 300008;
int n, a[N], b[N];
int maxx(int x, int y) {
  if (x > y) y = x;
  return y;
}
int minx(int x, int y) {
  if (x < y) y = x;
  return y;
}
int main(void) {
  int i, k;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", a + i);
  b[n - 1] = a[1];
  for (i = 2; i <= n; i++) b[n - 1] = maxx(b[n - 1], a[i]);
  for (i = 1; i < n; i++) {
    k = n - 2 * minx(i, n - i);
    b[k] = maxx(b[k], maxx(a[i], a[i + 1]));
  }
  for (i = 2; i < n; i++) {
    k = n - 2 * minx(i - 1, n - i) - 1;
    b[k] = maxx(b[k], minx(a[i], maxx(a[i - 1], a[i + 1])));
  }
  for (i = 2; i < n; i++) b[i] = maxx(b[i], b[i - 2]);
  for (i = 0; i < n; i++) printf("%d ", b[i]);
  return 0;
}
