#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i = 0; i < (int)(N); i++) cin >> v[i];
  for (int i = 0; i < N; i++) {
    int m = v[i];
    v[i] = 0;
    sort(v.begin(), v.end());
    printf("%d\n", v[N - 1]);
    v[i] = m;
  }
}
