#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
int n;
int a[maxn], g[maxn], h[maxn], f[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    f[1] = max(f[1], a[i]);
  }
  for (int i = 1; i < n; i++)
    h[min(i, n - i)] = max(h[min(i, n - i)], max(a[i], a[i + 1]));
  for (int i = 2; i < n; i++)
    g[min(i - 1, n - i)] = max(g[min(i - 1, n - i)],
                               max(min(a[i - 1], a[i]), min(a[i], a[i + 1])));
  for (int i = n / 2; i >= 1; i--) {
    f[i * 2] = max(f[i * 2 + 2], h[i]);
    f[i * 2 + 1] = max(f[i * 2 + 3], g[i]);
  }
  for (int i = n; i >= 1; i--) {
    printf("%d ", f[i]);
  }
  return 0;
}
