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