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