#include <bits/stdc++.h>
const int N = 500005, base = 9971;
using namespace std;
int n, a[N], f[N];
void upd(int &x, int y) { x = max(x, y); }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  f[n - 1] = 0;
  for (int i = 1; i <= n; ++i) f[n - 1] = max(f[n - 1], a[i]);
  for (int i = 1; i <= n - 1; ++i) {
    int ret = max(a[i], a[i + 1]);
    upd(f[n - min(n - i, i) * 2], ret);
  }
  for (int i = 2; i <= n - 1; ++i) {
    int ret = min(a[i], max(a[i - 1], a[i + 1]));
    upd(f[n - min(i - 1, n - i) * 2 - 1], ret);
  }
  for (int i = 3; i <= n; ++i) upd(f[i], f[i - 2]);
  for (int i = 0; i <= n - 1; ++i) printf("%d ", f[i]);
  return 0;
}
