#include <bits/stdc++.h>
using namespace std;
int main() {
  int count = 0;
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < (int)(N + 1); i++) {
    cin >> A[i];
  }
  for (int i = 0; i < (int)(N); i++) {
    vector<int> B(N);
    B = A;
    B[i] = 0;
    count = *max_element(B.begin(), B.end());
    cout << count << endl;
  }
}
