#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  for (int i = 0; i < (int)(n); i++) {
    int keep = a[i], ans = 0;
    a[i] = 0;
    for (int j = 0; j < (int)(n); j++) {
      ans = max(ans, a[j]);
    }
    cout << ans << endl;
    a[i] = keep;
  }
  return 0;
}
