#include <bits/stdc++.h>
using namespace std;
int a[300005], n;
set<pair<int, int> > e, o;
int mx;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], mx = max(mx, a[i]);
  for (int i = 0; i < n; i++) {
    if (i == n - 1) {
      cout << mx << endl;
      return 0;
    }
    int x = n - i;
    if (x % 2 == 0) {
      int m = x / 2;
      if (m - 1 >= 0) e.insert(make_pair(a[m - 1], m - 1));
      e.insert(make_pair(a[m], m));
      if (m != 0) e.insert(make_pair(a[n - m], n - m));
      if (n - m - 1 >= 0) e.insert(make_pair(a[n - m - 1], n - m - 1));
      set<pair<int, int> >::iterator it = e.end();
      it--;
      cout << (*it).first << " ";
    } else {
      int m = (x - 1) / 2;
      if (m - 1 >= 0 && m + 1 < n)
        o.insert(make_pair(max(min(a[m - 1], a[m]), min(a[m], a[m + 1])), m));
      if (n - m < n && n - m - 2 >= 0)
        o.insert(make_pair(
            max(min(a[n - m], a[n - m - 1]), min(a[n - m - 1], a[n - m - 2])),
            n - m - 1));
      set<pair<int, int> >::iterator it = o.end();
      it--;
      cout << (*it).first << " ";
    }
  }
}
