#include <bits/stdc++.h>
using namespace std;
using Int = long long;
Int INF = 1LL << 60;
int main() {
  Int N;
  cin >> N;
  vector<Int> a(N);
  vector<Int> temp(N);
  for (Int i = 0; i < N; i++) cin >> a[i];
  for (Int i = 0; i < N; i++) {
    temp = a;
    temp[i] = 0;
    Int ans = *max_element(temp.begin(), temp.end());
    cout << ans << endl;
  }
}
