#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 7;
int a[N];
int res[N][2];
int main(int argc, char** argv) {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  for (int i = 0; i < n; ++i) {
    res[n - 1][!(n & 1)] = max(res[n - 1][!(n & 1)], a[i]);
    if (i > 0) {
      int x = max(a[i], a[i - 1]);
      int len = n - 2 - 2 * min(i - 1, n - 1 - i);
      res[len][n & 1] = max(res[len][n & 1], x);
    }
    if (i > 1) {
      int x = min(a[i - 1], max(a[i - 2], a[i]));
      int len = n - 3 - 2 * min(i - 2, n - 1 - i);
      res[len][!(n & 1)] = max(res[len][!(n & 1)], x);
    }
  }
  for (int i = 1; i < n; ++i) {
    res[i][0] = max(res[i][0], res[i - 1][0]);
    res[i][1] = max(res[i][1], res[i - 1][1]);
  }
  for (int i = 0; i < n; ++i) {
    printf("%d ", res[i][i & 1]);
  }
  puts("");
  return 0;
}
