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