#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int a[N], b[N], dp[N], ans;
void solve() {
  int x;
  cin >> x;
  for (int i = 1; i <= x; i++) {
    cin >> a[i];
    ans = max(ans, a[i]);
  }
  if (x == 1) {
    cout << a[1];
    return;
  }
  if (x == 2) {
    cout << max(a[1], a[2]);
    return;
  }
  for (int i = 1; i < x; i++) {
    int mx = max(a[i], a[i + 1]);
    int x1 = i - 1;
    int y = x - (i + 1);
    dp[abs(x1 - y)] = max(mx, dp[abs(x1 - y)]);
  }
  for (int i = 1; i < x - 1; i++) {
    int mn = min(a[i + 1], max(a[i], a[i + 2]));
    int x1 = i - 1;
    int y = x - (i + 2);
    dp[abs(x1 - y)] = max(dp[abs(x1 - y)], mn);
  }
  for (int i = 2; i < x - 1; i++) {
    dp[i] = max(dp[i], dp[i - 2]);
  }
  for (int i = 0; i < x - 1; i++) {
    cout << dp[i] << ' ';
  }
  cout << ans;
}
int main() { solve(); }
