#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 3;
int a[MAXN], n;
int ev[MAXN], od[MAXN];
int ans[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    ans[1] = max(ans[1], a[i]);
  }
  for (int i = 1; i < n; i++) {
    int j = min(i, n - i);
    ev[j] = max(ev[j], max(a[i], a[i + 1]));
  }
  for (int i = 2; i < n; i++) {
    int j = min(i - 1, n - i);
    od[j] = max(od[j], min(a[i], max(a[i - 1], a[i + 1])));
  }
  for (int i = n / 2; i >= 1; i--) {
    ans[i * 2] = max(ans[(i + 1) * 2], ev[i]);
  }
  for (int i = (n - 1) / 2; i >= 1; i--) {
    ans[i * 2 + 1] = max(ans[(i + 1) * 2 + 1], od[i]);
  }
  for (int i = n; i >= 1; i--) printf("%d ", ans[i]);
  return 0;
}
