#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int a[n], max_a;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    max_a = 0;
    for (int j = 0; j < n; j++) {
      if (j != i) max_a = max(max_a, a[j]);
    }
    cout << max_a << endl;
  }
}
