#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int maxn = 3e5 + 1;
int a[maxn];
int n;
int odd[maxn], even[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (long long(i) = (0); (i) < (n); ++(i)) {
    cin >> a[i];
  }
  if (n == 1) {
    cout << a[0] << '\n';
    return 0;
  }
  for (long long(i) = (0); (i) < (n - 1); ++(i)) {
    even[i] = max(a[i], a[i + 1]);
  }
  for (long long(i) = (0); (i) < (n - 2); ++(i)) {
    odd[i] = min(a[i + 1], max(a[i], a[i + 2]));
  }
  multiset<int> os, es;
  for (int i = 0; i < n - 1; ++i) {
    if (n % 2 == 0) {
      if (i % 2 == 0) {
        es.insert(even[(n - 1) / 2 + i / 2]);
        es.insert(even[(n - 1) / 2 - i / 2]);
        cout << *es.rbegin() << " ";
      } else {
        os.insert(odd[(n - 1) / 2 + (i + 1) / 2 - 1]);
        os.insert(odd[(n - 1) / 2 - (i + 1) / 2]);
        cout << *os.rbegin() << " ";
      }
    } else {
      if (i % 2 == 0) {
        os.insert(odd[(n / 2 - 1 + i / 2)]);
        os.insert(odd[n / 2 - 1 - i / 2]);
        cout << *os.rbegin() << " ";
      } else {
        es.insert(even[n / 2 - 1 + (i + 1) / 2]);
        es.insert(even[n / 2 - 1 - (i + 1) / 2 + 1]);
        cout << *es.rbegin() << " ";
      }
    }
  }
  cout << *max_element(a, a + n) << '\n';
}
