#include <bits/stdc++.h>
using namespace std;
const int NMax = 300005;
int N;
int A[NMax];
int Ans[NMax], Max, Ans2[NMax];
void Read() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
    Max = max(Max, A[i]);
  }
}
void precalcAns() {
  int left = (N + 1) / 2, right = (N + 1) / 2;
  if (N % 2 == 0) right++;
  Ans2[0] = max(A[left], A[right]);
  if (left < right) Ans[0] = min(A[left], A[right]);
  int pos = 1;
  left--;
  right++;
  while (left > 0 && right <= N) {
    Ans[pos] = Ans[pos - 1];
    Ans2[pos] = Ans2[pos - 1];
    Ans[pos] = max(Ans[pos], min(A[left], A[left + 1]));
    Ans[pos] = max(Ans[pos], min(A[right], A[right - 1]));
    Ans2[pos] = max(Ans2[pos], A[left]);
    Ans2[pos] = max(Ans2[pos], A[right]);
    ++pos;
    --left;
    ++right;
  }
}
void Solve() {
  for (int i = 0; i < N - 1; i++) {
    int rem = N - i;
    if (rem % 2 == 0) {
      if (N % 2 == 1)
        cout << Ans2[(i + 1) / 2] << " ";
      else
        cout << Ans2[i / 2] << " ";
    } else {
      if (N % 2 == 1)
        cout << Ans[(i + 2) / 2] << " ";
      else
        cout << Ans[(i + 1) / 2] << " ";
    }
  }
  cout << Max << " ";
}
int main() {
  Read();
  precalcAns();
  Solve();
  return 0;
}
