#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 100;
int n, a[N], b[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), b[i] = min(a[i - 1], a[i]);
  int las0 = 0, las1 = 0;
  if (n & 1)
    las0 = a[(n + 1) >> 1];
  else
    las1 = b[(n + 2) >> 1];
  for (int k = 0; k <= n - 2; ++k) {
    if ((n ^ k) & 1) {
      las1 = max(las1, max(b[(n - k + 1) >> 1], b[(n + k + 3) >> 1]));
      printf("%d ", las1);
    } else {
      las0 = max(las0, max(a[(n - k) >> 1], a[(n + k + 2) >> 1]));
      printf("%d ", las0);
    }
  }
  for (int i = 1; i <= n; ++i) las0 = max(las0, a[i]);
  printf("%d ", las0);
  return 0;
}
