#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(2 * N);
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A.at(i) = a;
    A.at(N + i) = a;
  }
  for (int i = 0; i < N; i++) {
    int M = 0;
    for (int j = 1; j < N; j++) {
      M = max(M, A.at(i + j));
    }
    cout << M << endl;
  }
}
