#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < (n); ++i) {
    cin >> v[i];
  }
  for (int i = 0; i < (n); ++i) {
    vector<int> v1(n);
    copy(v.begin(), v.end(), v1.begin());
    v1[i] = 0;
    sort(v1.begin(), v1.end());
    cout << v1[n - 1] << endl;
  }
}
