#include <bits/stdc++.h>
using namespace std;
const int N = 3 * 1e5 + 3;
int even[N], odd[N], n, a[N], ans[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), ans[1] = max(a[i], ans[1]);
  for (int i = 1; i < n; i++) {
    int len = min(i, n - i);
    even[len] = max(even[len], max(a[i], a[i + 1]));
  }
  for (int i = 1; i <= n - 2; i++) {
    int len = min(i, n - i - 1);
    odd[len] = max(odd[len], min(a[i + 1], max(a[i], a[i + 2])));
  }
  int ev = n, od = n;
  if (n & 1)
    ev--;
  else
    od--;
  for (int i = ev; i >= 2; i -= 2) {
    ans[i] = max(ans[i + 2], even[i >> 1]);
  }
  for (int i = od; i >= 3; i -= 2) {
    ans[i] = max(ans[i + 2], odd[i >> 1]);
  }
  for (int i = n; i >= 1; i--) printf("%d%c", ans[i], i == 1 ? '\n' : ' ');
  return 0;
}
