#include <bits/stdc++.h>
using namespace std;
int f(int a, int b, int c) { return min(b, max(a, c)); }
int f(const vector<int>& a, int i) {
  assert(i > 0 && i + 1 < a.size());
  return f(a[i - 1], a[i], a[i + 1]);
}
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  vector<int> res(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    res[n - 1] = max(res[n - 1], a[i]);
  }
  if (n == 1) {
    printf("%d\n", a[0]);
    return 0;
  }
  if (n % 2) {
    res[1] = max(a[n / 2], max(a[n / 2 - 1], a[n / 2 + 1]));
    for (int t = 3; t < n; t += 2) {
      res[t] = max(res[t - 2], max(a[n / 2 - 1 - t / 2], a[n / 2 + 1 + t / 2]));
    }
    res[0] = f(a, n / 2);
    for (int t = 2; t < n - 2; t += 2) {
      res[t] = max(res[t - 2], max(f(a, n / 2 - t / 2), f(a, n / 2 + t / 2)));
    }
  } else {
    for (int i = 0; i + 2 < n; ++i) {
      int val = f(a, i + 1);
      int pos = abs(n - 2 * i - 3);
      res[pos] = max(res[pos], val);
    }
    res[0] = max(a[n / 2], a[n / 2 - 1]);
    for (int t = 2; t < n; t += 2) {
      res[t] = max(
          res[t], max(res[t - 2], max(a[n / 2 - 1 - t / 2], a[n / 2 + t / 2])));
    }
    if (n != 2) {
      res[1] = max(f(a, n / 2 - 1), f(a, n / 2));
      for (int t = 3; t < n - 2; ++t) {
        res[t] = max(res[t], max(res[t - 2], max(f(a, n / 2 - 1 - t / 2),
                                                 f(a, n / 2 + t / 2))));
      }
    }
  }
  for (int i = 0; i < n; ++i) printf("%d ", res[i]);
  return 0;
}
