#include <bits/stdc++.h>
using namespace std;
int n;
int carrot[300000];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> carrot[i];
  int poans = 0;
  int peans = 0;
  for (int i = 0; i < n; i++) {
    if ((n - i) % 2) {
      int ca = (n - i) / 2, cb = (n + i) / 2;
      int thisans = carrot[ca];
      if (n - i > 1)
        thisans = min(thisans, max(carrot[ca - 1], carrot[ca + 1]));
      poans = max(poans, thisans);
      thisans = carrot[cb];
      if (n - i > 1)
        thisans = min(thisans, max(carrot[cb - 1], carrot[cb + 1]));
      poans = max(poans, thisans);
      if (n - i == 1) {
        for (int j = 0; j < n; j++) poans = max(poans, carrot[j]);
      }
      cout << poans << " ";
    } else {
      int ca = (n - i - 1) / 2;
      int cb = (n + i - 1) / 2;
      int thisans = max(carrot[ca], carrot[ca + 1]);
      peans = max(peans, thisans);
      thisans = max(carrot[cb], carrot[cb + 1]);
      peans = max(peans, thisans);
      cout << peans << " ";
    }
  }
  cout << endl;
}
