#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, t;
  deque<long long> l;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> t;
    l.push_back(t);
  }
  long long s = 0;
  for (long long i = 0; i < n; i++) {
    s = l[0];
    l.pop_front();
    cout << *max_element(l.begin(), l.end()) << endl;
    l.push_back(s);
  }
}
