#include <bits/stdc++.h>
using namespace std;
const long long SZ = 510, INF = 1e9 * 1e9 + 100;
long long n, m;
long long dist[SZ][SZ], dp[SZ][SZ], cnt[SZ][SZ], adj[SZ][SZ], dp2[SZ][SZ],
    to[SZ][SZ];
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  cin >> n;
  vector<long long> vec(n), vec2;
  for (auto &cur : vec) cin >> cur;
  vector<pair<long long, long long>> s, s2;
  for (long long i = 0; i < n; i++) {
    if (i < n - 1) {
      vec2.push_back(min(vec[i], vec[i + 1]));
      long long dl = max(i, n - i - 2) - min(i, n - i - 2);
      s2.push_back({dl, vec2.back()});
    }
    long long dl = max(i, n - i - 1) - min(i, n - i - 1);
    s.push_back({dl, vec[i]});
  }
  sort(s.rbegin(), s.rend());
  sort(s2.rbegin(), s2.rend());
  long long cur = s.back().second;
  long long cur2 = -INF;
  if (s2.size() > 0) cur2 = s2.back().second;
  for (int i = 0; i <= n - 1; i++) {
    long long lft = n - i - 1;
    if (lft == 0) {
      long long c = 0;
      for (int j = 0; j < n; j++) {
        c = max(c, vec[j]);
      }
      cout << c;
      continue;
    }
    if ((n - i - 1) % 2) {
      while (s.size() > 1) {
        if (s[s.size() - 2].first <= i + 1) {
          cur = max(cur, s[s.size() - 2].second);
          s.pop_back();
        } else {
          break;
        }
      }
      cout << cur << " ";
      continue;
    }
    deque<long long> q;
    while (s2.size() > 1) {
      if (s2[s2.size() - 2].first <= i + 1) {
        cur2 = max(cur2, s2[s2.size() - 2].second);
        s2.pop_back();
      } else {
        break;
      }
    }
    cout << cur2 << " ";
  }
  return 0;
}
