#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  auto a = vector<int>(n);
  for (auto &a_i : a) cin >> a_i;
  const auto copy = a;
  a.insert(a.end(), copy.begin(), copy.end());
  for (int i = 0; i < n; i++) {
    cout << *max_element(a.begin() + (i + 1), a.begin() + (i + 1) + (n - 1))
         << "\n";
  }
  return 0;
}
