#include <bits/stdc++.h>
using namespace std;
signed main() {
  int D, N, M, O, P, count = 0, count2 = 0, count3 = 0, stack = 0;
  string S, T;
  double l, s;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  for (int i = 0; i < N; i++) {
    count = a[i];
    a[i] = 0;
    for (int j = 0; j < N; j++) {
      if (count2 <= a[j]) count2 = a[j];
    }
    cout << count2 << endl;
    count2 = 0;
    a[i] = count;
  }
}
